C++11 conformance and consistency: Added "move" constructors and assignment operators to OpenFOAM containers

Replaced all uses of complex Xfer class with C++11 "move" constructors and
assignment operators.  Removed the now redundant Xfer class.

This substantial changes improves consistency between OpenFOAM and the C++11 STL
containers and algorithms, reduces memory allocation and copy overhead when
returning containers from functions and simplifies maintenance of the core
libraries significantly.
This commit is contained in:
Henry Weller
2019-05-25 17:40:39 +01:00
parent 0889ff91c7
commit 30bea84fac
323 changed files with 3238 additions and 2500 deletions

View File

@ -25,10 +25,10 @@ fvMesh mesh
runTime, runTime,
IOobject::READ_IF_PRESENT IOobject::READ_IF_PRESENT
), ),
xferMove<Field<vector>>(points), move(points),
faces.xfer(), move(faces),
owner.xfer(), move(owner),
neighbour.xfer() move(neighbour)
); );
List<polyPatch*> patches(1); List<polyPatch*> patches(1);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -261,7 +261,7 @@ Foam::InterfaceCompositionPhaseChangePhaseSystem<BasePhaseSystem>::dmdt
template<class BasePhaseSystem> template<class BasePhaseSystem>
Foam::Xfer<Foam::PtrList<Foam::volScalarField>> Foam::PtrList<Foam::volScalarField>
Foam::InterfaceCompositionPhaseChangePhaseSystem<BasePhaseSystem>::dmdts() const Foam::InterfaceCompositionPhaseChangePhaseSystem<BasePhaseSystem>::dmdts() const
{ {
PtrList<volScalarField> dmdts(BasePhaseSystem::dmdts()); PtrList<volScalarField> dmdts(BasePhaseSystem::dmdts());
@ -302,7 +302,7 @@ Foam::InterfaceCompositionPhaseChangePhaseSystem<BasePhaseSystem>::dmdts() const
} }
} }
return dmdts.xfer(); return dmdts;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -133,7 +133,7 @@ public:
virtual tmp<volScalarField> dmdt(const phasePairKey& key) const; virtual tmp<volScalarField> dmdt(const phasePairKey& key) const;
//- Return the mass transfer rates for each phase //- Return the mass transfer rates for each phase
virtual Xfer<PtrList<volScalarField>> dmdts() const; virtual PtrList<volScalarField> dmdts() const;
//- Return the mass transfer matrices //- Return the mass transfer matrices
virtual autoPtr<phaseSystem::massTransferTable> massTransfer() const; virtual autoPtr<phaseSystem::massTransferTable> massTransfer() 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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -451,7 +451,7 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::momentumTransferf()
template<class BasePhaseSystem> template<class BasePhaseSystem>
Foam::Xfer<Foam::PtrList<Foam::surfaceScalarField>> Foam::PtrList<Foam::surfaceScalarField>
Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::AFfs() const Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::AFfs() const
{ {
PtrList<surfaceScalarField> AFfs(this->phaseModels_.size()); PtrList<surfaceScalarField> AFfs(this->phaseModels_.size());
@ -485,12 +485,12 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::AFfs() const
this->fillFields("AFf", dimDensity/dimTime, AFfs); this->fillFields("AFf", dimDensity/dimTime, AFfs);
} }
return AFfs.xfer(); return AFfs;
} }
template<class BasePhaseSystem> template<class BasePhaseSystem>
Foam::Xfer<Foam::PtrList<Foam::surfaceScalarField>> Foam::PtrList<Foam::surfaceScalarField>
Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiFs Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiFs
( (
const PtrList<volScalarField>& rAUs const PtrList<volScalarField>& rAUs
@ -626,12 +626,12 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiFs
this->fillFields("phiF", dimForce/dimDensity/dimVelocity, phiFs); this->fillFields("phiF", dimForce/dimDensity/dimVelocity, phiFs);
} }
return phiFs.xfer(); return phiFs;
} }
template<class BasePhaseSystem> template<class BasePhaseSystem>
Foam::Xfer<Foam::PtrList<Foam::surfaceScalarField>> Foam::PtrList<Foam::surfaceScalarField>
Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiFfs Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiFfs
( (
const PtrList<surfaceScalarField>& rAUfs const PtrList<surfaceScalarField>& rAUfs
@ -789,12 +789,12 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiFfs
this->fillFields("phiFf", dimForce/dimDensity/dimVelocity, phiFfs); this->fillFields("phiFf", dimForce/dimDensity/dimVelocity, phiFfs);
} }
return phiFfs.xfer(); return phiFfs;
} }
template<class BasePhaseSystem> template<class BasePhaseSystem>
Foam::Xfer<Foam::PtrList<Foam::surfaceScalarField>> Foam::PtrList<Foam::surfaceScalarField>
Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiKdPhis Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiKdPhis
( (
const PtrList<volScalarField>& rAUs const PtrList<volScalarField>& rAUs
@ -831,12 +831,12 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiKdPhis
); );
} }
return phiKdPhis.xfer(); return phiKdPhis;
} }
template<class BasePhaseSystem> template<class BasePhaseSystem>
Foam::Xfer<Foam::PtrList<Foam::surfaceScalarField>> Foam::PtrList<Foam::surfaceScalarField>
Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiKdPhifs Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiKdPhifs
( (
const PtrList<surfaceScalarField>& rAUfs const PtrList<surfaceScalarField>& rAUfs
@ -873,12 +873,12 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiKdPhifs
); );
} }
return phiKdPhifs.xfer(); return phiKdPhifs;
} }
template<class BasePhaseSystem> template<class BasePhaseSystem>
Foam::Xfer<Foam::PtrList<Foam::volVectorField>> Foam::PtrList<Foam::volVectorField>
Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::KdUByAs Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::KdUByAs
( (
const PtrList<volScalarField>& rAUs const PtrList<volScalarField>& rAUs
@ -909,12 +909,12 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::KdUByAs
this->fillFields("KdUByA", dimVelocity, KdUByAs); this->fillFields("KdUByA", dimVelocity, KdUByAs);
} }
return KdUByAs.xfer(); return KdUByAs;
} }
template<class BasePhaseSystem> template<class BasePhaseSystem>
Foam::Xfer<Foam::PtrList<Foam::surfaceScalarField>> Foam::PtrList<Foam::surfaceScalarField>
Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::ddtCorrByAs Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::ddtCorrByAs
( (
const PtrList<volScalarField>& rAUs, const PtrList<volScalarField>& rAUs,
@ -1009,7 +1009,7 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::ddtCorrByAs
} }
} }
return ddtCorrByAs.xfer(); return ddtCorrByAs;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -212,19 +212,19 @@ public:
//- Return implicit force coefficients on the faces, for the face-based //- Return implicit force coefficients on the faces, for the face-based
// algorithm. // algorithm.
virtual Xfer<PtrList<surfaceScalarField>> AFfs() const; virtual PtrList<surfaceScalarField> AFfs() const;
//- Return the explicit force fluxes for the cell-based algorithm, that //- Return the explicit force fluxes for the cell-based algorithm, that
// do not depend on phase mass/volume fluxes, and can therefore be // do not depend on phase mass/volume fluxes, and can therefore be
// evaluated outside the corrector loop. This includes things like // evaluated outside the corrector loop. This includes things like
// lift, turbulent dispersion, and wall lubrication. // lift, turbulent dispersion, and wall lubrication.
virtual Xfer<PtrList<surfaceScalarField>> phiFs virtual PtrList<surfaceScalarField> phiFs
( (
const PtrList<volScalarField>& rAUs const PtrList<volScalarField>& rAUs
); );
//- As phiFs, but for the face-based algorithm //- As phiFs, but for the face-based algorithm
virtual Xfer<PtrList<surfaceScalarField>> phiFfs virtual PtrList<surfaceScalarField> phiFfs
( (
const PtrList<surfaceScalarField>& rAUfs const PtrList<surfaceScalarField>& rAUfs
); );
@ -232,13 +232,13 @@ public:
//- Return the explicit drag force fluxes for the cell-based algorithm. //- Return the explicit drag force fluxes for the cell-based algorithm.
// These depend on phase mass/volume fluxes, and must therefore be // These depend on phase mass/volume fluxes, and must therefore be
// evaluated inside the corrector loop. // evaluated inside the corrector loop.
virtual Xfer<PtrList<surfaceScalarField>> phiKdPhis virtual PtrList<surfaceScalarField> phiKdPhis
( (
const PtrList<volScalarField>& rAUs const PtrList<volScalarField>& rAUs
) const; ) const;
//- As phiKdPhis, but for the face-based algorithm //- As phiKdPhis, but for the face-based algorithm
virtual Xfer<PtrList<surfaceScalarField>> phiKdPhifs virtual PtrList<surfaceScalarField> phiKdPhifs
( (
const PtrList<surfaceScalarField>& rAUfs const PtrList<surfaceScalarField>& rAUfs
) const; ) const;
@ -247,7 +247,7 @@ public:
// algorithm. This is the cell-equivalent of phiKdPhis. These depend on // algorithm. This is the cell-equivalent of phiKdPhis. These depend on
// phase velocities, and must therefore be evaluated inside the // phase velocities, and must therefore be evaluated inside the
// corrector loop. // corrector loop.
virtual Xfer<PtrList<volVectorField>> KdUByAs virtual PtrList<volVectorField> KdUByAs
( (
const PtrList<volScalarField>& rAUs const PtrList<volScalarField>& rAUs
) const; ) const;
@ -268,7 +268,7 @@ public:
//- Return the flux corrections for the cell-based algorithm. These //- Return the flux corrections for the cell-based algorithm. These
// depend on phase mass/volume fluxes, and must therefore be evaluated // depend on phase mass/volume fluxes, and must therefore be evaluated
// inside the corrector loop. // inside the corrector loop.
virtual Xfer<PtrList<surfaceScalarField>> ddtCorrByAs virtual PtrList<surfaceScalarField> ddtCorrByAs
( (
const PtrList<volScalarField>& rAUs, const PtrList<volScalarField>& rAUs,
const bool includeVirtualMass = false const bool includeVirtualMass = false

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -102,7 +102,7 @@ Foam::PhaseTransferPhaseSystem<BasePhaseSystem>::dmdt
template<class BasePhaseSystem> template<class BasePhaseSystem>
Foam::Xfer<Foam::PtrList<Foam::volScalarField>> Foam::PtrList<Foam::volScalarField>
Foam::PhaseTransferPhaseSystem<BasePhaseSystem>::dmdts() const Foam::PhaseTransferPhaseSystem<BasePhaseSystem>::dmdts() const
{ {
PtrList<volScalarField> dmdts(BasePhaseSystem::dmdts()); PtrList<volScalarField> dmdts(BasePhaseSystem::dmdts());
@ -116,7 +116,7 @@ Foam::PhaseTransferPhaseSystem<BasePhaseSystem>::dmdts() const
this->addField(pair.phase2(), "dmdt", - rDmdt, dmdts); this->addField(pair.phase2(), "dmdt", - rDmdt, dmdts);
} }
return dmdts.xfer(); return dmdts;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -105,7 +105,7 @@ public:
virtual tmp<volScalarField> dmdt(const phasePairKey& key) const; virtual tmp<volScalarField> dmdt(const phasePairKey& key) const;
//- Return the mass transfer rates for each phase //- Return the mass transfer rates for each phase
virtual Xfer<PtrList<volScalarField>> dmdts() const; virtual PtrList<volScalarField> dmdts() const;
//- Return the mass transfer matrices //- Return the mass transfer matrices
virtual autoPtr<phaseSystem::massTransferTable> massTransfer() const; virtual autoPtr<phaseSystem::massTransferTable> massTransfer() 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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2017-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -148,7 +148,7 @@ Foam::PopulationBalancePhaseSystem<BasePhaseSystem>::dmdt
template<class BasePhaseSystem> template<class BasePhaseSystem>
Foam::Xfer<Foam::PtrList<Foam::volScalarField>> Foam::PtrList<Foam::volScalarField>
Foam::PopulationBalancePhaseSystem<BasePhaseSystem>::dmdts() const Foam::PopulationBalancePhaseSystem<BasePhaseSystem>::dmdts() const
{ {
PtrList<volScalarField> dmdts(BasePhaseSystem::dmdts()); PtrList<volScalarField> dmdts(BasePhaseSystem::dmdts());
@ -162,7 +162,7 @@ Foam::PopulationBalancePhaseSystem<BasePhaseSystem>::dmdts() const
this->addField(pair.phase2(), "dmdt", - pDmdt, dmdts); this->addField(pair.phase2(), "dmdt", - pDmdt, dmdts);
} }
return dmdts.xfer(); return dmdts;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2017-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -96,7 +96,7 @@ public:
virtual tmp<volScalarField> dmdt(const phasePairKey& key) const; virtual tmp<volScalarField> dmdt(const phasePairKey& key) const;
//- Return the mass transfer rates for each phase //- Return the mass transfer rates for each phase
virtual Xfer<PtrList<volScalarField>> dmdts() const; virtual PtrList<volScalarField> dmdts() const;
//- Return the mass transfer matrices //- Return the mass transfer matrices
virtual autoPtr<phaseSystem::massTransferTable> massTransfer() const; virtual autoPtr<phaseSystem::massTransferTable> massTransfer() const;

View File

@ -188,7 +188,7 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::dmdt
template<class BasePhaseSystem> template<class BasePhaseSystem>
Foam::Xfer<Foam::PtrList<Foam::volScalarField>> Foam::PtrList<Foam::volScalarField>
Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::dmdts() const Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::dmdts() const
{ {
PtrList<volScalarField> dmdts(BasePhaseSystem::dmdts()); PtrList<volScalarField> dmdts(BasePhaseSystem::dmdts());
@ -211,7 +211,7 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::dmdts() const
this->addField(pair.phase2(), "dmdt", - wDmdt, dmdts); this->addField(pair.phase2(), "dmdt", - wDmdt, dmdts);
} }
return dmdts.xfer(); return dmdts;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -121,7 +121,7 @@ public:
virtual tmp<volScalarField> dmdt(const phasePairKey& key) const; virtual tmp<volScalarField> dmdt(const phasePairKey& key) const;
//- Return the mass transfer rates for each phase //- Return the mass transfer rates for each phase
virtual Xfer<PtrList<volScalarField>> dmdts() const; virtual PtrList<volScalarField> dmdts() const;
//- Return the heat transfer matrices //- Return the heat transfer matrices
virtual autoPtr<phaseSystem::heatTransferTable> heatTransfer() const; virtual autoPtr<phaseSystem::heatTransferTable> heatTransfer() 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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -342,11 +342,11 @@ Foam::tmp<Foam::volScalarField> Foam::phaseSystem::dmdt
} }
Foam::Xfer<Foam::PtrList<Foam::volScalarField>> Foam::phaseSystem::dmdts() const Foam::PtrList<Foam::volScalarField> Foam::phaseSystem::dmdts() const
{ {
PtrList<volScalarField> dmdts(this->phaseModels_.size()); PtrList<volScalarField> dmdts(this->phaseModels_.size());
return dmdts.xfer(); return dmdts;
} }

View File

@ -441,7 +441,7 @@ public:
virtual tmp<volScalarField> dmdt(const phasePairKey& key) const; virtual tmp<volScalarField> dmdt(const phasePairKey& key) const;
//- Return the mass transfer rates for each phase //- Return the mass transfer rates for each phase
virtual Xfer<PtrList<volScalarField>> dmdts() const; virtual PtrList<volScalarField> dmdts() const;
// Transfers // Transfers
@ -456,34 +456,34 @@ public:
//- Return the implicit force coefficients for the face-based //- Return the implicit force coefficients for the face-based
// algorithm // algorithm
virtual Xfer<PtrList<surfaceScalarField>> AFfs() const = 0; virtual PtrList<surfaceScalarField> AFfs() const = 0;
//- Return the force fluxes for the cell-based algorithm //- Return the force fluxes for the cell-based algorithm
virtual Xfer<PtrList<surfaceScalarField>> phiFs virtual PtrList<surfaceScalarField> phiFs
( (
const PtrList<volScalarField>& rAUs const PtrList<volScalarField>& rAUs
) = 0; ) = 0;
//- Return the force fluxes for the face-based algorithm //- Return the force fluxes for the face-based algorithm
virtual Xfer<PtrList<surfaceScalarField>> phiFfs virtual PtrList<surfaceScalarField> phiFfs
( (
const PtrList<surfaceScalarField>& rAUfs const PtrList<surfaceScalarField>& rAUfs
) = 0; ) = 0;
//- Return the force fluxes for the cell-based algorithm //- Return the force fluxes for the cell-based algorithm
virtual Xfer<PtrList<surfaceScalarField>> phiKdPhis virtual PtrList<surfaceScalarField> phiKdPhis
( (
const PtrList<volScalarField>& rAUs const PtrList<volScalarField>& rAUs
) const = 0; ) const = 0;
//- Return the force fluxes for the face-based algorithm //- Return the force fluxes for the face-based algorithm
virtual Xfer<PtrList<surfaceScalarField>> phiKdPhifs virtual PtrList<surfaceScalarField> phiKdPhifs
( (
const PtrList<surfaceScalarField>& rAUfs const PtrList<surfaceScalarField>& rAUfs
) const = 0; ) const = 0;
//- Return the explicit part of the drag force //- Return the explicit part of the drag force
virtual Xfer<PtrList<volVectorField>> KdUByAs virtual PtrList<volVectorField> KdUByAs
( (
const PtrList<volScalarField>& rAUs const PtrList<volScalarField>& rAUs
) const = 0; ) const = 0;
@ -501,7 +501,7 @@ public:
) = 0; ) = 0;
//- Return the flux corrections for the cell-based algorithm //- Return the flux corrections for the cell-based algorithm
virtual Xfer<PtrList<surfaceScalarField>> ddtCorrByAs virtual PtrList<surfaceScalarField> ddtCorrByAs
( (
const PtrList<volScalarField>& rAUs, const PtrList<volScalarField>& rAUs,
const bool includeVirtualMass = false const bool includeVirtualMass = false

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -173,13 +173,13 @@ int main(int argc, char *argv[])
printInfo("dlC", dlC, true); printInfo("dlC", dlC, true);
List<label> lstB(dlC.xfer()); List<label> lstB(move(dlC));
Info<< "Transferred to normal list via the xfer() method" << endl; Info<< "Moved to normal list" << endl;
printInfo("lstB", lstB, true); printInfo("lstB", lstB, true);
printInfo("dlC", dlC, true); printInfo("dlC", dlC, true);
DynamicList<label> dlD(lstB.xfer()); DynamicList<label> dlD(move(lstB));
Info<< "Transfer construct from normal list" << endl; Info<< "Transfer construct from normal list" << endl;
printInfo("lstB", lstB, true); printInfo("lstB", lstB, true);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -94,10 +94,10 @@ int main()
HashTable<scalar> table2(table1); HashTable<scalar> table2(table1);
HashTable<scalar> table3(table1.xfer()); HashTable<scalar> table3(move(table1));
Info<< "\ncopy table1 -> table2" << nl Info<< "\ncopy table1 -> table2" << nl
<< "transfer table1 -> table3 via the xfer() method" << nl; << "move table1 -> table3" << nl;
Info<< "\ntable1" << table1 << nl Info<< "\ntable1" << table1 << nl
<< "\ntable2" << table2 << nl << "\ntable2" << table2 << nl

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -65,7 +65,7 @@ int main(int argc, char *argv[])
Info<< "table3: " << table3 << nl Info<< "table3: " << table3 << nl
<< "toc: " << table3.toc() << endl; << "toc: " << table3.toc() << endl;
Map<label> table4(table3.xfer()); Map<label> table4(move(table3));
Info<< "table3: " << table3 << nl Info<< "table3: " << table3 << nl
<< "toc: " << table3.toc() << endl; << "toc: " << table3.toc() << 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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -71,7 +71,7 @@ int main(int argc, char *argv[])
addresses[1] = 8; addresses[1] = 8;
addresses[0] = 5; addresses[0] = 5;
idl1.resetAddressing(addresses.xfer()); idl1.resetAddressing(move(addresses));
printInfo(idl1); printInfo(idl1);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -80,8 +80,8 @@ int main(int argc, char *argv[])
list2.setSize(10, vector(1, 2, 3)); list2.setSize(10, vector(1, 2, 3));
Info<< "list2: " << list2 << endl; Info<< "list2: " << list2 << endl;
List<vector> list3(list2.xfer()); List<vector> list3(move(list2));
Info<< "Transferred via the xfer() method" << endl; Info<< "Transferred move" << endl;
Info<< "list2: " << list2 << nl Info<< "list2: " << list2 << nl
<< "list3: " << list3 << endl; << "list3: " << list3 << endl;

View File

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

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "StaticHashTable.H" #include "ListHashTable.H"
#include "IOstreams.H" #include "IOstreams.H"
#include "IStringStream.H" #include "IStringStream.H"
#include "OStringStream.H" #include "OStringStream.H"
@ -31,7 +31,7 @@ License
using namespace Foam; using namespace Foam;
// use define so we can easily test other implementations // use define so we can easily test other implementations
#define HASHTABLE_CLASS StaticHashTable #define HASHTABLE_CLASS ListHashTable
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program: // Main program:
@ -91,10 +91,10 @@ int main()
HASHTABLE_CLASS<double> table2(table1); HASHTABLE_CLASS<double> table2(table1);
HASHTABLE_CLASS<double> table3(table1.xfer()); HASHTABLE_CLASS<double> table3(move(table1));
Info<< "\ncopy table1 -> table2" << nl Info<< "\ncopy table1 -> table2" << nl
<< "transfer table1 -> table3 via the xfer() method" << nl; << "move table1 -> table3" << nl;
Info<< "\ntable1" << table1 << nl Info<< "\ntable1" << table1 << nl
<< "\ntable2" << table2 << nl << "\ntable2" << table2 << nl

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -116,8 +116,8 @@ int main(int argc, char *argv[])
Info<<"list1: " << list1 << endl; Info<<"list1: " << list1 << endl;
PtrList<Scalar> list3(list1.xfer()); PtrList<Scalar> list3(move(list1));
Info<< "Transferred via the xfer() method" << endl; Info<< "Transferred via move" << endl;
Info<<"list1: " << list1 << endl; Info<<"list1: " << list1 << endl;
Info<<"list2: " << list2 << endl; Info<<"list2: " << list2 << endl;

View File

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

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -70,7 +70,7 @@ int main(int argc, char *argv[])
<< "keys: " << dict1.keys() << nl << "keys: " << dict1.keys() << nl
<< "patterns: " << dict1.keys(true) << endl; << "patterns: " << dict1.keys(true) << endl;
dictionary dict2(dict1.xfer()); dictionary dict2(move(dict1));
Info<< "dict1.toc(): " << dict1.name() << " " << dict1.toc() << nl Info<< "dict1.toc(): " << dict1.name() << " " << dict1.toc() << nl
<< "dict2.toc(): " << dict2.name() << " " << dict2.toc() << "dict2.toc(): " << dict2.name() << " " << dict2.toc()

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -92,7 +92,7 @@ int main(int argc, char *argv[])
runTime, runTime,
Foam::IOobject::NO_READ Foam::IOobject::NO_READ
), ),
Xfer<pointField>(points), clone(points),
shapes, shapes,
boundaryFaces, boundaryFaces,
boundaryPatchNames, boundaryPatchNames,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -126,7 +126,7 @@ int main(int argc, char *argv[])
// Construct distribute map (destructively) // Construct distribute map (destructively)
mapDistribute map(constructSize, sendMap.xfer(), recvMap.xfer()); mapDistribute map(constructSize, move(sendMap), move(recvMap));
// Distribute complexData // Distribute complexData
map.distribute(complexData); map.distribute(complexData);

View File

@ -247,15 +247,15 @@ int main(int argc, char *argv[])
writeFaceFaces(localPoints, localFaces, faceFaces); writeFaceFaces(localPoints, localFaces, faceFaces);
} }
// Test construction from Xfer // Test move construction
{ {
faceList patchFaces = patch; faceList patchFaces = patch;
pointField allPoints = patch.points(); pointField allPoints = patch.points();
PrimitivePatch<faceList, pointField> storedPatch PrimitivePatch<faceList, pointField> storedPatch
( (
patchFaces.xfer(), move(patchFaces),
allPoints.xfer() move(allPoints)
); );
} }

View File

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

View File

@ -1,135 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 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/>.
Application
Description
\*---------------------------------------------------------------------------*/
#include "OSspecific.H"
#include "IOstreams.H"
#include "IStringStream.H"
#include "labelList.H"
#include "DynamicList.H"
#include "face.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
List<label> lstA(10);
List<label> lstC(IStringStream("(1 2 3 4)")());
forAll(lstA, i)
{
lstA[i] = i;
}
Info<< "lstA: " << lstA << endl;
Info<< "lstC: " << lstC << endl;
Xfer<List<label>> xA = xferMove(lstA);
Xfer<List<label>> xB;
List<label> lstB( xA );
Info<< "xA: " << xA() << endl;
Info<< "xB: " << xB() << endl;
Info<< "lstA: " << lstA << endl;
Info<< "lstB: " << lstB << endl;
Info<< "lstC: " << lstC << endl;
xA = lstB;
Info<< "xA: " << xA() << endl;
Info<< "xB: " << xB() << endl;
Info<< "lstA: " << lstA << endl;
Info<< "lstB: " << lstB << endl;
Info<< "lstC: " << lstC << endl;
xB = xA;
List<label> lstD(xferCopy(lstC));
List<label> lstE(xferMove(lstC));
// this must be empty
List<label> lstF = xferCopy(lstC);
Info<< "xA: " << xA() << endl;
Info<< "xB: " << xB() << endl;
Info<< "lstA: " << lstA << endl;
Info<< "lstB: " << lstB << endl;
Info<< "lstC: " << lstC << endl;
Info<< "lstD: " << lstD << endl;
Info<< "lstE: " << lstE << endl;
Info<< "lstF: " << lstF << endl;
Info<< "xB[" << xB->size() << "]\n";
// clear the underlying List
xB->clear();
Info<< "xB[" << xB->size() << "]\n";
DynamicList<label> dl(10);
for (label i = 0; i < 5; ++i)
{
dl.append(i);
}
face f1(dl);
face f2(xferCopy<labelList>(dl));
Info<< "dl[" << dl.size() << "/" << dl.capacity() << "] " << dl << endl;
Info<< "f1: " << f1 << endl;
Info<< "f2: " << f2 << endl;
// add some more labels
for (label i = 5; i < 8; ++i)
{
dl.append(i);
}
// note: xfer() method returns a plain labelList
face f3(dl.xfer());
Info<< "dl[" << dl.size() << "/" << dl.capacity() << "] " << dl << endl;
Info<< "f3: " << f3 << endl;
Info<<"\nflip faces:" << endl;
f1.flip();
f3.flip();
Info<< "f1: " << f1 << endl;
Info<< "f3: " << f3 << endl;
return 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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -211,9 +211,9 @@ int main(int argc, char *argv[])
runTime.timeName(), runTime.timeName(),
runTime runTime
), ),
xferCopy(mesh.points()), // could we safely re-use the data? clone(mesh.points()), // could we safely re-use the data?
xferCopy(mesh.faces()), clone(mesh.faces()),
xferCopy(mesh.cells()) clone(mesh.cells())
); );
// Add the boundary patches // Add the boundary patches

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -948,10 +948,10 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove<pointField>(foamPoints), move(foamPoints),
xferMove<faceList>(foamFaces), move(foamFaces),
xferCopy<labelList>(foamOwner), clone(foamOwner),
xferMove<labelList>(foamNeighbour) move(foamNeighbour)
); );
// Create patches. Use patch types to determine what Foam types to generate. // Create patches. Use patch types to determine what Foam types to generate.

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -448,7 +448,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferCopy(points), clone(points),
cellShapes, cellShapes,
faceListList(0), faceListList(0),
wordList(0), wordList(0),
@ -595,7 +595,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(points), move(points),
cellShapes, cellShapes,
patchFaces, patchFaces,
patchNames, patchNames,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -737,7 +737,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(points), move(points),
cellShapes, cellShapes,
boundary, boundary,
patchNames, patchNames,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -932,10 +932,10 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferCopy(pointField()), pointField(),
xferCopy(faceList()), faceList(),
xferCopy(labelList()), labelList(),
xferCopy(labelList()) labelList()
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -1167,7 +1167,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(points), move(points),
cellShapes, cellShapes,
patches, patches,
patchNames, patchNames,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -843,7 +843,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(points), move(points),
cells, cells,
boundary, boundary,
patchNames, patchNames,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -916,7 +916,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(points), move(points),
cells, cells,
boundaryFaces, boundaryFaces,
boundaryPatchNames, boundaryPatchNames,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -1129,15 +1129,15 @@ int main(int argc, char *argv[])
// Create globally numbered surface // Create globally numbered surface
meshedSurface rawSurface meshedSurface rawSurface
( (
xferCopy(polyPoints), clone(polyPoints),
xferCopyTo<faceList>(boundaryFaces) clone(boundaryFaces)
); );
// Write locally numbered surface // Write locally numbered surface
meshedSurface meshedSurface
( (
xferCopy(rawSurface.localPoints()), clone(rawSurface.localPoints()),
xferCopy(rawSurface.localFaces()) clone(rawSurface.localFaces())
).write(runTime.path()/"boundaryFaces.obj"); ).write(runTime.path()/"boundaryFaces.obj");
} }
@ -1172,7 +1172,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(polyPoints), move(polyPoints),
cellVerts, cellVerts,
usedPatchFaceVerts, // boundaryFaces, usedPatchFaceVerts, // boundaryFaces,
usedPatchNames, // boundaryPatchNames, usedPatchNames, // boundaryPatchNames,

View File

@ -565,7 +565,7 @@ polyMesh pShapeMesh
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(points), move(points),
cellShapes, cellShapes,
boundary, boundary,
patchNames, patchNames,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -141,7 +141,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(points), move(points),
cells, cells,
faceListList(0), faceListList(0),
wordList(0), wordList(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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -300,7 +300,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(points), move(points),
cells, cells,
patchFaces, patchFaces,
patchNames, patchNames,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -245,7 +245,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(newPoints), move(newPoints),
cellShapes, cellShapes,
boundary, boundary,
patchNames, patchNames,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -46,7 +46,7 @@ void Foam::sammMesh::writeMesh()
runTime_.constant(), runTime_.constant(),
runTime_ runTime_
), ),
xferCopy(points_), // we could probably re-use the data clone(points_), // we could probably re-use the data
cellShapes_, cellShapes_,
boundary_, boundary_,
patchNames_, patchNames_,
@ -75,9 +75,9 @@ void Foam::sammMesh::writeMesh()
runTime_.constant(), runTime_.constant(),
runTime_ runTime_
), ),
xferCopy(points_), // we could probably re-use the data move(points_), // we could probably re-use the data
xferCopy(meshFaces_), move(meshFaces_),
xferCopy(cellPolys_) move(cellPolys_)
); );
pMesh.addPatches(polyBoundaryPatches(pMesh)); pMesh.addPatches(polyBoundaryPatches(pMesh));

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -50,7 +50,7 @@ void Foam::starMesh::writeMesh()
runTime_.constant(), runTime_.constant(),
runTime_ runTime_
), ),
xferCopy(points_), // we could probably re-use the data clone(points_), // we could probably re-use the data
cellShapes_, cellShapes_,
boundary_, boundary_,
patchNames_, patchNames_,
@ -81,9 +81,9 @@ void Foam::starMesh::writeMesh()
runTime_.constant(), runTime_.constant(),
runTime_ runTime_
), ),
xferCopy(points_), // we could probably re-use the data clone(points_), // we could probably re-use the data
xferCopy(meshFaces_), clone(meshFaces_),
xferCopy(cellPolys_) clone(cellPolys_)
); );
// adding patches also checks the mesh // adding patches also checks the mesh

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -326,7 +326,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferCopy(points), clone(points),
cells, cells,
faceListList(0), faceListList(0),
wordList(0), // boundaryPatchNames wordList(0), // boundaryPatchNames
@ -530,7 +530,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(points), move(points),
cells, cells,
patchFaces, patchFaces,
patchNames, patchNames,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -62,7 +62,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferMove(reader.points()), move(reader.points()),
reader.cells(), reader.cells(),
faceListList(0), faceListList(0),
wordList(0), wordList(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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -267,7 +267,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
xferCopy(blocks.points()), // could we re-use space? clone(blocks.points()), // could we re-use space?
blocks.cells(), blocks.cells(),
blocks.patches(), blocks.patches(),
blocks.patchNames(), blocks.patchNames(),

View File

@ -63,7 +63,7 @@ class extrudedMesh
//- Construct and return the extruded mesh points //- Construct and return the extruded mesh points
template<class FaceList, class PointField> template<class FaceList, class PointField>
Xfer<pointField> extrudedPoints pointField extrudedPoints
( (
const PrimitivePatch<FaceList, PointField>& extrudePatch, const PrimitivePatch<FaceList, PointField>& extrudePatch,
const extrudeModel& const extrudeModel&
@ -71,7 +71,7 @@ class extrudedMesh
//- Construct and return the extruded mesh faces //- Construct and return the extruded mesh faces
template<class FaceList, class PointField> template<class FaceList, class PointField>
Xfer<faceList> extrudedFaces faceList extrudedFaces
( (
const PrimitivePatch<FaceList, PointField>& extrudePatch, const PrimitivePatch<FaceList, PointField>& extrudePatch,
const extrudeModel& const extrudeModel&
@ -79,7 +79,7 @@ class extrudedMesh
//- Construct and return the extruded mesh cells //- Construct and return the extruded mesh cells
template<class FaceList, class PointField> template<class FaceList, class PointField>
Xfer<cellList> extrudedCells cellList extrudedCells
( (
const PrimitivePatch<FaceList, PointField>& extrudePatch, const PrimitivePatch<FaceList, PointField>& extrudePatch,
const extrudeModel& const extrudeModel&

View File

@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class FaceList, class PointField> template<class FaceList, class PointField>
Foam::Xfer<Foam::pointField> Foam::extrudedMesh::extrudedPoints Foam::pointField Foam::extrudedMesh::extrudedPoints
( (
const PrimitivePatch<FaceList, PointField>& extrudePatch, const PrimitivePatch<FaceList, PointField>& extrudePatch,
const extrudeModel& model const extrudeModel& model
@ -57,13 +57,12 @@ Foam::Xfer<Foam::pointField> Foam::extrudedMesh::extrudedPoints
} }
} }
// return points for transferring return ePoints;
return xferMove(ePoints);
} }
template<class FaceList, class PointField> template<class FaceList, class PointField>
Foam::Xfer<Foam::faceList> Foam::extrudedMesh::extrudedFaces Foam::faceList Foam::extrudedMesh::extrudedFaces
( (
const PrimitivePatch<FaceList, PointField>& extrudePatch, const PrimitivePatch<FaceList, PointField>& extrudePatch,
const extrudeModel& model const extrudeModel& model
@ -183,13 +182,12 @@ Foam::Xfer<Foam::faceList> Foam::extrudedMesh::extrudedFaces
); );
} }
// return points for transferring return eFaces;
return xferMove(eFaces);
} }
template<class FaceList, class PointField> template<class FaceList, class PointField>
Foam::Xfer<Foam::cellList> Foam::extrudedMesh::extrudedCells Foam::cellList Foam::extrudedMesh::extrudedCells
( (
const PrimitivePatch<FaceList, PointField>& extrudePatch, const PrimitivePatch<FaceList, PointField>& extrudePatch,
const extrudeModel& model const extrudeModel& model
@ -290,8 +288,7 @@ Foam::Xfer<Foam::cellList> Foam::extrudedMesh::extrudedCells
facei++; facei++;
} }
// return points for transferring return eCells;
return xferMove(eCells);
} }

View File

@ -1824,7 +1824,7 @@ int main(int argc, char *argv[])
} }
} }
} }
const primitiveFacePatch extrudePatch(zoneFaces.xfer(), mesh.points()); const primitiveFacePatch extrudePatch(move(zoneFaces), mesh.points());
Pstream::listCombineGather(isInternal, orEqOp<bool>()); Pstream::listCombineGather(isInternal, orEqOp<bool>());
@ -2349,10 +2349,10 @@ int main(int argc, char *argv[])
IOobject::AUTO_WRITE, IOobject::AUTO_WRITE,
false false
), ),
xferCopy(pointField()), pointField(),
xferCopy(faceList()), faceList(),
xferCopy(labelList()), labelList(),
xferCopy(labelList()), labelList(),
false false
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -199,10 +199,10 @@ int main(int argc, char *argv[])
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
xferMove(poly2DMesh.points()), move(poly2DMesh.points()),
xferMove(poly2DMesh.faces()), move(poly2DMesh.faces()),
xferMove(poly2DMesh.owner()), move(poly2DMesh.owner()),
xferMove(poly2DMesh.neighbour()) move(poly2DMesh.neighbour())
) )
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -247,7 +247,7 @@ void Foam::patchToPoly2DMesh::addPatchFacesToOwner()
<< nExternalEdges << endl; << nExternalEdges << endl;
} }
owner_ = newOwner.xfer(); owner_ = move(newOwner);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -605,10 +605,10 @@ Foam::DelaunayMesh<Triangulation>::createMesh
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
xferMove(points), move(points),
xferMove(faces), move(faces),
xferMove(owner), move(owner),
xferMove(neighbour) move(neighbour)
) )
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -113,8 +113,8 @@ Foam::DistributedDelaunayMesh<Triangulation>::buildMap
new mapDistribute new mapDistribute
( (
constructSize, constructSize,
sendMap.xfer(), move(sendMap),
constructMap.xfer() move(constructMap)
) )
); );
} }
@ -214,7 +214,7 @@ Foam::labelList Foam::DistributedDelaunayMesh<Triangulation>::overlapProcessors
} }
} }
return toProc; return move(toProc);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -35,9 +35,7 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(backgroundMeshDecomposition, 0);
defineTypeNameAndDebug(backgroundMeshDecomposition, 0);
} }
@ -118,8 +116,8 @@ Foam::autoPtr<Foam::mapDistribute> Foam::backgroundMeshDecomposition::buildMap
new mapDistribute new mapDistribute
( (
constructSize, constructSize,
sendMap.xfer(), move(sendMap),
constructMap.xfer() move(constructMap)
) )
); );
} }
@ -1370,7 +1368,7 @@ Foam::labelList Foam::backgroundMeshDecomposition::overlapProcessors
} }
} }
return toProc; return Foam::move(toProc);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -739,10 +739,10 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
xferCopy(pts), clone(pts),
xferMove(faces), Foam::move(faces),
xferMove(owner), Foam::move(owner),
xferMove(neighbour) Foam::move(neighbour)
) )
); );
@ -991,7 +991,7 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::findOffsetPatchFaces
offsetBoundaryCells.write(); offsetBoundaryCells.write();
} }
return offsetBoundaryCells; return Foam::move(offsetBoundaryCells);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -1839,7 +1839,7 @@ Foam::conformalVoronoiMesh::nearestFeatureEdgeLocations
dynPointHit.append(nearHit); dynPointHit.append(nearHit);
} }
return dynPointHit; return Foam::move(dynPointHit);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -444,7 +444,7 @@ inline Foam::List<bool> Foam::conformalVoronoiMesh::dualFaceBoundaryPoints
} while (cc1 != ccStart); } while (cc1 != ccStart);
return tmpFaceBoundaryPoints; return Foam::move(tmpFaceBoundaryPoints);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -410,9 +410,9 @@ Foam::autoPtr<Foam::fvMesh> Foam::conformalVoronoiMesh::createDummyMesh
new fvMesh new fvMesh
( (
io, io,
xferCopy(pointField()), pointField(),
xferCopy(faceList()), faceList(),
xferCopy(cellList()) cellList()
) )
); );
fvMesh& mesh = meshPtr(); fvMesh& mesh = meshPtr();
@ -817,10 +817,10 @@ void Foam::conformalVoronoiMesh::writeMesh
IOobject::NO_READ, IOobject::NO_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
xferMove(points), Foam::move(points),
xferMove(faces), Foam::move(faces),
xferMove(owner), Foam::move(owner),
xferMove(neighbour) Foam::move(neighbour)
); );
Info<< indent << "Adding patches to mesh" << endl; Info<< indent << "Adding patches to mesh" << endl;
@ -1399,7 +1399,7 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::findRemainingProtrusionSet
protrudingCells.write(); protrudingCells.write();
} }
return protrudingCells; return Foam::move(protrudingCells);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -961,7 +961,7 @@ List<Vb::Point> autoDensity::initialPoints() const
<< decrIndent << decrIndent << decrIndent << decrIndent
<< endl; << endl;
return initialPoints; return move(initialPoints);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -194,7 +194,7 @@ List<Vb::Point> pointFile::initialPoints() const
<< pointFileName_.name() << endl; << pointFileName_.name() << endl;
} }
return initialPoints; return Foam::move(initialPoints);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -287,7 +287,7 @@ autoPtr<polyMesh> generateHexMesh
new polyMesh new polyMesh
( (
io, io,
xferMoveTo<pointField>(points), move(points),
cellShapes, cellShapes,
boundary, boundary,
patchNames, patchNames,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -155,10 +155,10 @@ int main(int argc, char *argv[])
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
xferMove(poly2DMesh.points()), move(poly2DMesh.points()),
xferMove(poly2DMesh.faces()), move(poly2DMesh.faces()),
xferMove(poly2DMesh.owner()), move(poly2DMesh.owner()),
xferMove(poly2DMesh.neighbour()) move(poly2DMesh.neighbour())
); );
Info<< "Constructing patches." << endl; Info<< "Constructing patches." << 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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -204,7 +204,7 @@ Foam::shortEdgeFilter2D::shortEdgeFilter2D
points2D.clear(); points2D.clear();
ms_ = MeshedSurface<face>(xferMove(points), xferMove(faces)); ms_ = MeshedSurface<face>(move(points), move(faces));
Info<< "Meshed surface stats before edge filtering :" << endl; Info<< "Meshed surface stats before edge filtering :" << endl;
ms_.writeStats(Info); ms_.writeStats(Info);
@ -535,9 +535,9 @@ Foam::shortEdgeFilter2D::filter()
MeshedSurface<face> fMesh MeshedSurface<face> fMesh
( (
xferMove(newPoints), move(newPoints),
xferMove(newFaces), move(newFaces),
xferCopy(List<surfZone>()) List<surfZone>()
); );
updateEdgeRegionMap updateEdgeRegionMap

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -471,7 +471,7 @@ void extractSurface
// Gather all ZoneIDs // Gather all ZoneIDs
List<labelList> gatheredZones(Pstream::nProcs()); List<labelList> gatheredZones(Pstream::nProcs());
gatheredZones[Pstream::myProcNo()] = compactZones.xfer(); gatheredZones[Pstream::myProcNo()] = move(compactZones);
Pstream::gatherList(gatheredZones); Pstream::gatherList(gatheredZones);
// On master combine all points, faces, zones // On master combine all points, faces, zones
@ -510,10 +510,10 @@ void extractSurface
UnsortedMeshedSurface<face> unsortedFace UnsortedMeshedSurface<face> unsortedFace
( (
xferMove(allPoints), move(allPoints),
xferMove(allFaces), move(allFaces),
xferMove(allZones), move(allZones),
xferMove(surfZones) move(surfZones)
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -392,9 +392,9 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io, const word& dictName)
new fvMesh new fvMesh
( (
io, io,
xferMove(newPoints), move(newPoints),
xferMove(newFaces), move(newFaces),
xferMove(newCells) move(newCells)
) )
); );

View File

@ -448,10 +448,10 @@ autoPtr<mapPolyMesh> reorderMesh
mesh.resetPrimitives mesh.resetPrimitives
( (
Xfer<pointField>::null(), NullObjectMove<pointField>(),
xferMove(newFaces), move(newFaces),
xferMove(newOwner), move(newOwner),
xferMove(newNeighbour), move(newNeighbour),
patchSizes, patchSizes,
patchStarts, patchStarts,
true true

View File

@ -357,9 +357,9 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
facesInstance(), facesInstance(),
processorDb processorDb
), ),
xferMove(facesInstancePoints), move(facesInstancePoints),
xferMove(procFaces), move(procFaces),
xferMove(procCells) move(procCells)
) )
); );
} }
@ -375,9 +375,9 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
facesInstance(), facesInstance(),
processorDb processorDb
), ),
xferMove(procPoints), move(procPoints),
xferMove(procFaces), move(procFaces),
xferMove(procCells) move(procCells)
) )
); );
} }
@ -758,7 +758,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
xferMove(procPoints) move(procPoints)
); );
pointsInstancePoints.write(); pointsInstancePoints.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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -673,9 +673,9 @@ int main(int argc, char *argv[])
runTime, runTime,
IOobject::NO_READ IOobject::NO_READ
), ),
xferCopy(pointField()), pointField(),
xferCopy(faceList()), faceList(),
xferCopy(cellList()) cellList()
) )
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -132,10 +132,10 @@ Foam::autoPtr<Foam::fvMesh> Foam::loadOrCreateMesh
fvMesh dummyMesh fvMesh dummyMesh
( (
noReadIO, noReadIO,
xferCopy(pointField()), pointField(),
xferCopy(faceList()), faceList(),
xferCopy(labelList()), labelList(),
xferCopy(labelList()), labelList(),
false false
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,7 +49,7 @@ Foam::tmp<Foam::Field<Type>> Foam::readParticleField
if (obj != nullptr) if (obj != nullptr)
{ {
IOField<Type> newField(*obj); IOField<Type> newField(*obj);
return tmp<Field<Type>>(new Field<Type>(newField.xfer())); return tmp<Field<Type>>(new Field<Type>(move(newField)));
} }
FatalErrorInFunction FatalErrorInFunction
@ -77,7 +77,7 @@ void Foam::readFields
{ {
Info<< " reading field " << fieldNames[j] << endl; Info<< " reading field " << fieldNames[j] << endl;
IOField<Type> newField(*obj); IOField<Type> newField(*obj);
values.set(j, new List<Type>(newField.xfer())); values.set(j, new List<Type>(move(newField)));
} }
else else
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -334,7 +334,7 @@ int main(int argc, char *argv[])
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
surf.xfer() move(surf)
); );
Info<< "writing surfMesh as well: " << surfOut.objectPath() << endl; Info<< "writing surfMesh as well: " << surfOut.objectPath() << 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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -284,7 +284,7 @@ int main(int argc, char *argv[])
runTime.constant(), runTime.constant(),
runTime runTime
), ),
surf.xfer() move(surf)
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -308,7 +308,7 @@ int main(int argc, char *argv[])
// Gather all ZoneIDs // Gather all ZoneIDs
List<labelList> gatheredZones(Pstream::nProcs()); List<labelList> gatheredZones(Pstream::nProcs());
gatheredZones[Pstream::myProcNo()] = compactZones.xfer(); gatheredZones[Pstream::myProcNo()] = move(compactZones);
Pstream::gatherList(gatheredZones); Pstream::gatherList(gatheredZones);
// On master combine all points, faces, zones // On master combine all points, faces, zones
@ -347,10 +347,10 @@ int main(int argc, char *argv[])
UnsortedMeshedSurface<face> unsortedFace UnsortedMeshedSurface<face> unsortedFace
( (
xferMove(allPoints), move(allPoints),
xferMove(allFaces), move(allFaces),
xferMove(allZones), move(allZones),
xferMove(surfZones) move(surfZones)
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -1357,7 +1357,8 @@ Foam::fileNameList Foam::dlLoaded()
<< "dlLoaded()" << "dlLoaded()"
<< " : determined loaded libraries :" << libs.size() << std::endl; << " : determined loaded libraries :" << libs.size() << std::endl;
} }
return libs;
return move(libs);
} }

View File

@ -142,7 +142,7 @@ primitives/Barycentric/barycentric/barycentric.C
primitives/Barycentric2D/barycentric2D/barycentric2D.C primitives/Barycentric2D/barycentric2D/barycentric2D.C
containers/HashTables/HashTable/HashTableCore.C containers/HashTables/HashTable/HashTableCore.C
containers/HashTables/StaticHashTable/StaticHashTableCore.C containers/HashTables/ListHashTable/ListHashTableCore.C
containers/Lists/SortableList/ParSortableListName.C containers/Lists/SortableList/ParSortableListName.C
containers/Lists/PackedList/PackedListCore.C containers/Lists/PackedList/PackedListCore.C
containers/Lists/PackedList/PackedBoolList.C containers/Lists/PackedList/PackedBoolList.C

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -104,12 +104,12 @@ Foam::treeDataCell::treeDataCell
( (
const bool cacheBb, const bool cacheBb,
const polyMesh& mesh, const polyMesh& mesh,
const Xfer<labelList>& cellLabels, labelList&& cellLabels,
const polyMesh::cellDecomposition decompMode const polyMesh::cellDecomposition decompMode
) )
: :
mesh_(mesh), mesh_(mesh),
cellLabels_(cellLabels), cellLabels_(move(cellLabels)),
cacheBb_(cacheBb), cacheBb_(cacheBb),
decompMode_(decompMode) decompMode_(decompMode)
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -146,12 +146,12 @@ public:
const polyMesh::cellDecomposition decompMode const polyMesh::cellDecomposition decompMode
); );
//- Construct from mesh and subset of cells, transferring contents //- Move construct from mesh and subset of cells, transferring contents
treeDataCell treeDataCell
( (
const bool cacheBb, const bool cacheBb,
const polyMesh&, const polyMesh&,
const Xfer<labelList>&, labelList&&,
const polyMesh::cellDecomposition decompMode const polyMesh::cellDecomposition decompMode
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -41,6 +41,13 @@ Foam::Dictionary<T>::Dictionary(const Dictionary& dict)
{} {}
template<class T>
Foam::Dictionary<T>::Dictionary(Dictionary&& dict)
:
DictionaryBase<IDLList<T>, T>(move(dict))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T> template<class 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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -64,9 +64,12 @@ public:
//- Construct given initial table size //- Construct given initial table size
Dictionary(const label size = 128); Dictionary(const label size = 128);
//- Copy construct //- Copy constructor
Dictionary(const Dictionary&); Dictionary(const Dictionary&);
//- Move constructor
Dictionary(Dictionary&&);
// Member functions // Member functions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -63,6 +63,17 @@ Foam::DictionaryBase<IDLListType, T>::DictionaryBase
} }
template<class IDLListType, class T>
Foam::DictionaryBase<IDLListType, T>::DictionaryBase
(
DictionaryBase&& dict
)
:
IDLListType(move(dict)),
hashedTs_(move(dict.hashedTs_))
{}
template<class IDLListType, class T> template<class IDLListType, class T>
template<class INew> template<class INew>
Foam::DictionaryBase<IDLListType, T>::DictionaryBase Foam::DictionaryBase<IDLListType, T>::DictionaryBase

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -95,9 +95,12 @@ public:
//- Construct given initial table size //- Construct given initial table size
DictionaryBase(const label size = 128); DictionaryBase(const label size = 128);
//- Copy construct //- Copy constructor
DictionaryBase(const DictionaryBase&); DictionaryBase(const DictionaryBase&);
//- Move constructor
DictionaryBase(DictionaryBase&&);
//- Construct from Istream using given Istream constructor class //- Construct from Istream using given Istream constructor class
template<class INew> template<class INew>
DictionaryBase(Istream&, const INew&); DictionaryBase(Istream&, const INew&);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -41,6 +41,13 @@ Foam::PtrDictionary<T>::PtrDictionary(const PtrDictionary& dict)
{} {}
template<class T>
Foam::PtrDictionary<T>::PtrDictionary(PtrDictionary&& dict)
:
DictionaryBase<DLPtrList<T>, T>(move(dict))
{}
template<class T> template<class T>
template<class INew> template<class INew>
Foam::PtrDictionary<T>::PtrDictionary(Istream& is, const INew& iNew) Foam::PtrDictionary<T>::PtrDictionary(Istream& is, const INew& iNew)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -63,9 +63,12 @@ public:
//- Construct given initial table size //- Construct given initial table size
PtrDictionary(const label size = 128); PtrDictionary(const label size = 128);
//- Copy construct //- Copy constructor
PtrDictionary(const PtrDictionary&); PtrDictionary(const PtrDictionary&);
//- Move constructor
PtrDictionary(PtrDictionary&&);
//- Construct from Istream using given Istream constructor class //- Construct from Istream using given Istream constructor class
template<class INew> template<class INew>
PtrDictionary(Istream&, const INew&); PtrDictionary(Istream&, const INew&);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,6 +43,13 @@ Foam::PtrListDictionary<T>::PtrListDictionary(const PtrListDictionary& dict)
{} {}
template<class T>
Foam::PtrListDictionary<T>::PtrListDictionary(PtrListDictionary&& dict)
:
DictionaryBase<PtrList<T>, T>(move(dict))
{}
template<class T> template<class T>
template<class INew> template<class INew>
Foam::PtrListDictionary<T>::PtrListDictionary(Istream& is, const INew& iNew) Foam::PtrListDictionary<T>::PtrListDictionary(Istream& is, const INew& iNew)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -63,9 +63,12 @@ public:
//- Construct given initial list size //- Construct given initial list size
PtrListDictionary(const label size); PtrListDictionary(const label size);
//- Copy construct //- Copy constructor
PtrListDictionary(const PtrListDictionary&); PtrListDictionary(const PtrListDictionary&);
//- Move constructor
PtrListDictionary(PtrListDictionary&&);
//- Construct from Istream using given Istream constructor class //- Construct from Istream using given Istream constructor class
template<class INew> template<class INew>
PtrListDictionary(Istream&, const INew&); PtrListDictionary(Istream&, const INew&);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -50,6 +50,16 @@ Foam::HashPtrTable<T, Key, Hash>::HashPtrTable
} }
template<class T, class Key, class Hash>
Foam::HashPtrTable<T, Key, Hash>::HashPtrTable
(
HashPtrTable<T, Key, Hash>&& ht
)
:
HashTable<T*, Key, Hash>(move(ht))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
@ -132,6 +142,25 @@ void Foam::HashPtrTable<T, Key, Hash>::operator=
} }
} }
template<class T, class Key, class Hash>
void Foam::HashPtrTable<T, Key, Hash>::operator=
(
HashPtrTable<T, Key, Hash>&& rhs
)
{
// Check for assignment to self
if (this == &rhs)
{
FatalErrorInFunction
<< "attempted assignment to self"
<< abort(FatalError);
}
HashTable<T*, Key, Hash>::operator=(move(rhs));
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
#include "HashPtrTableIO.C" #include "HashPtrTableIO.C"

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -103,6 +103,9 @@ public:
//- Construct as copy //- Construct as copy
HashPtrTable(const HashPtrTable<T, Key, Hash>&); HashPtrTable(const HashPtrTable<T, Key, Hash>&);
//- Move constructor
HashPtrTable(HashPtrTable<T, Key, Hash>&&);
//- Destructor //- Destructor
~HashPtrTable(); ~HashPtrTable();
@ -127,8 +130,12 @@ public:
// Member Operators // Member Operators
//- Assignment operator
void operator=(const HashPtrTable<T, Key, Hash>&); void operator=(const HashPtrTable<T, Key, Hash>&);
//- Move assignment operator
void operator=(HashPtrTable<T, Key, Hash>&&);
// IOstream Operators // IOstream Operators

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -104,6 +104,36 @@ inline bool Foam::HashSet<Key, Hash>::operator[](const Key& key) const
} }
template<class Key, class Hash>
void Foam::HashSet<Key, Hash>::operator=(const HashSet<Key, Hash>& rhs)
{
// Check for assignment to self
if (this == &rhs)
{
FatalErrorInFunction
<< "attempted assignment to self"
<< abort(FatalError);
}
HashTable<nil, Key, Hash>::operator=(rhs);
}
template<class Key, class Hash>
void Foam::HashSet<Key, Hash>::operator=(HashSet<Key, Hash>&& rhs)
{
// Check for assignment to self
if (this == &rhs)
{
FatalErrorInFunction
<< "attempted assignment to self"
<< abort(FatalError);
}
HashTable<nil, Key, Hash>::operator=(move(rhs));
}
template<class Key, class Hash> template<class Key, class Hash>
bool Foam::HashSet<Key, Hash>::operator==(const HashSet<Key, Hash>& rhs) const bool Foam::HashSet<Key, Hash>::operator==(const HashSet<Key, Hash>& rhs) 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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -90,22 +90,10 @@ public:
HashSet(const FixedList<Key, Size>&); HashSet(const FixedList<Key, Size>&);
//- Construct as copy //- Construct as copy
HashSet(const HashSet<Key, Hash>& hs) HashSet(const HashSet<Key, Hash>& hs) = default;
:
HashTable<nil, Key, Hash>(hs)
{}
//- Construct by transferring the parameter contents //- Move constructor
HashSet(const Xfer<HashSet<Key, Hash>>& hs) HashSet(HashSet<Key, Hash>&& hs) = default;
:
HashTable<nil, Key, Hash>(hs)
{}
//- Construct by transferring the parameter contents
HashSet(const Xfer<HashTable<nil, Key, Hash>>& hs)
:
HashTable<nil, Key, Hash>(hs)
{}
//- Construct from the keys of another HashTable, //- Construct from the keys of another HashTable,
// the type of values held is arbitrary. // the type of values held is arbitrary.
@ -151,6 +139,12 @@ public:
//- Return true if the entry exists, same as found() //- Return true if the entry exists, same as found()
inline bool operator[](const Key&) const; inline bool operator[](const Key&) const;
//- Assignment operator
void operator=(const HashSet<Key, Hash>&);
//- Move assignment operator
void operator=(HashSet<Key, Hash>&&);
//- Equality. Two hashtables are equal when their contents are equal. //- Equality. Two hashtables are equal when their contents are equal.
// Independent of table size or order. // Independent of table size or order.
bool operator==(const HashSet<Key, Hash>&) const; bool operator==(const HashSet<Key, Hash>&) 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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -67,7 +67,7 @@ Foam::HashTable<T, Key, Hash>::HashTable(const HashTable<T, Key, Hash>& ht)
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
Foam::HashTable<T, Key, Hash>::HashTable Foam::HashTable<T, Key, Hash>::HashTable
( (
const Xfer<HashTable<T, Key, Hash>>& ht HashTable<T, Key, Hash>&& ht
) )
: :
HashTableCore(), HashTableCore(),
@ -75,7 +75,7 @@ Foam::HashTable<T, Key, Hash>::HashTable
tableSize_(0), tableSize_(0),
table_(nullptr) table_(nullptr)
{ {
transfer(ht()); transfer(ht);
} }
@ -563,6 +563,24 @@ void Foam::HashTable<T, Key, Hash>::operator=
} }
template<class T, class Key, class Hash>
void Foam::HashTable<T, Key, Hash>::operator=
(
HashTable<T, Key, Hash>&& rhs
)
{
// Check for assignment to self
if (this == &rhs)
{
FatalErrorInFunction
<< "attempted assignment to self"
<< abort(FatalError);
}
transfer(rhs);
}
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
void Foam::HashTable<T, Key, Hash>::operator= void Foam::HashTable<T, Key, Hash>::operator=
( (

View File

@ -47,7 +47,6 @@ SourceFiles
#include "label.H" #include "label.H"
#include "uLabel.H" #include "uLabel.H"
#include "word.H" #include "word.H"
#include "Xfer.H"
#include "className.H" #include "className.H"
#include <initializer_list> #include <initializer_list>
@ -212,8 +211,8 @@ public:
//- Construct as copy //- Construct as copy
HashTable(const HashTable<T, Key, Hash>&); HashTable(const HashTable<T, Key, Hash>&);
//- Construct by transferring the parameter contents //- More Constructor
HashTable(const Xfer<HashTable<T, Key, Hash>>&); HashTable(HashTable<T, Key, Hash>&&);
//- Construct from an initializer list //- Construct from an initializer list
HashTable(std::initializer_list<Tuple2<Key, T>>); HashTable(std::initializer_list<Tuple2<Key, T>>);
@ -300,9 +299,6 @@ public:
// and annul the argument table. // and annul the argument table.
void transfer(HashTable<T, Key, Hash>&); void transfer(HashTable<T, Key, Hash>&);
//- Transfer contents to the Xfer container
inline Xfer<HashTable<T, Key, Hash>> xfer();
// Member Operators // Member Operators
@ -315,9 +311,12 @@ public:
//- Find and return a hashedEntry, create it null if not present //- Find and return a hashedEntry, create it null if not present
inline T& operator()(const Key&); inline T& operator()(const Key&);
//- Assignment //- Assignment operator
void operator=(const HashTable<T, Key, Hash>&); void operator=(const HashTable<T, Key, Hash>&);
//- Move assignment operator
void operator=(HashTable<T, Key, Hash>&&);
//- Assignment to an initializer list //- Assignment to an initializer list
void operator=(std::initializer_list<Tuple2<Key, T>>); void operator=(std::initializer_list<Tuple2<Key, 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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -97,14 +97,6 @@ inline bool Foam::HashTable<T, Key, Hash>::set
} }
template<class T, class Key, class Hash>
inline Foam::Xfer<Foam::HashTable<T, Key, Hash>>
Foam::HashTable<T, Key, Hash>::xfer()
{
return xferMove(*this);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class T, class Key, class Hash> template<class T, class Key, class Hash>

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,16 +23,16 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef StaticHashTable_C #ifndef ListHashTable_C
#define StaticHashTable_C #define ListHashTable_C
#include "StaticHashTable.H" #include "ListHashTable.H"
#include "List.H" #include "List.H"
#include "IOstreams.H" #include "IOstreams.H"
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
Foam::label Foam::StaticHashTableCore::canonicalSize(const label size) Foam::label Foam::ListHashTableCore::canonicalSize(const label size)
{ {
if (size < 1) if (size < 1)
{ {
@ -59,10 +59,10 @@ Foam::label Foam::StaticHashTableCore::canonicalSize(const label size)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
Foam::StaticHashTable<T, Key, Hash>::StaticHashTable(const label size) Foam::ListHashTable<T, Key, Hash>::ListHashTable(const label size)
: :
StaticHashTableCore(), ListHashTableCore(),
keys_(StaticHashTableCore::canonicalSize(size)), keys_(ListHashTableCore::canonicalSize(size)),
objects_(keys_.size()), objects_(keys_.size()),
nElmts_(0), nElmts_(0),
endIter_(*this, keys_.size(), 0), endIter_(*this, keys_.size(), 0),
@ -71,19 +71,19 @@ Foam::StaticHashTable<T, Key, Hash>::StaticHashTable(const label size)
if (size < 1) if (size < 1)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Illegal size " << size << " for StaticHashTable." << "Illegal size " << size << " for ListHashTable."
<< " Minimum size is 1" << abort(FatalError); << " Minimum size is 1" << abort(FatalError);
} }
} }
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
Foam::StaticHashTable<T, Key, Hash>::StaticHashTable Foam::ListHashTable<T, Key, Hash>::ListHashTable
( (
const StaticHashTable<T, Key, Hash>& ht const ListHashTable<T, Key, Hash>& ht
) )
: :
StaticHashTableCore(), ListHashTableCore(),
keys_(ht.keys_), keys_(ht.keys_),
objects_(ht.objects_), objects_(ht.objects_),
nElmts_(ht.nElmts_), nElmts_(ht.nElmts_),
@ -93,33 +93,33 @@ Foam::StaticHashTable<T, Key, Hash>::StaticHashTable
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
Foam::StaticHashTable<T, Key, Hash>::StaticHashTable Foam::ListHashTable<T, Key, Hash>::ListHashTable
( (
const Xfer<StaticHashTable<T, Key, Hash>>& ht ListHashTable<T, Key, Hash>&& ht
) )
: :
StaticHashTableCore(), ListHashTableCore(),
keys_(0), keys_(0),
objects_(0), objects_(0),
nElmts_(0), nElmts_(0),
endIter_(*this, 0, 0), endIter_(*this, 0, 0),
endConstIter_(*this, 0, 0) endConstIter_(*this, 0, 0)
{ {
transfer(ht()); transfer(ht);
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
Foam::StaticHashTable<T, Key, Hash>::~StaticHashTable() Foam::ListHashTable<T, Key, Hash>::~ListHashTable()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
bool Foam::StaticHashTable<T, Key, Hash>::found(const Key& key) const bool Foam::ListHashTable<T, Key, Hash>::found(const Key& key) const
{ {
if (nElmts_) if (nElmts_)
{ {
@ -147,8 +147,8 @@ bool Foam::StaticHashTable<T, Key, Hash>::found(const Key& key) const
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
typename Foam::StaticHashTable<T, Key, Hash>::iterator typename Foam::ListHashTable<T, Key, Hash>::iterator
Foam::StaticHashTable<T, Key, Hash>::find Foam::ListHashTable<T, Key, Hash>::find
( (
const Key& key const Key& key
) )
@ -179,8 +179,8 @@ Foam::StaticHashTable<T, Key, Hash>::find
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
typename Foam::StaticHashTable<T, Key, Hash>::const_iterator typename Foam::ListHashTable<T, Key, Hash>::const_iterator
Foam::StaticHashTable<T, Key, Hash>::find Foam::ListHashTable<T, Key, Hash>::find
( (
const Key& key const Key& key
) const ) const
@ -211,7 +211,7 @@ Foam::StaticHashTable<T, Key, Hash>::find
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
Foam::List<Key> Foam::StaticHashTable<T, Key, Hash>::toc() const Foam::List<Key> Foam::ListHashTable<T, Key, Hash>::toc() const
{ {
List<Key> keys(nElmts_); List<Key> keys(nElmts_);
label keyI = 0; label keyI = 0;
@ -226,7 +226,7 @@ Foam::List<Key> Foam::StaticHashTable<T, Key, Hash>::toc() const
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
bool Foam::StaticHashTable<T, Key, Hash>::set bool Foam::ListHashTable<T, Key, Hash>::set
( (
const Key& key, const Key& key,
const T& newEntry, const T& newEntry,
@ -284,7 +284,7 @@ bool Foam::StaticHashTable<T, Key, Hash>::set
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
bool Foam::StaticHashTable<T, Key, Hash>::erase(const iterator& cit) bool Foam::ListHashTable<T, Key, Hash>::erase(const iterator& cit)
{ {
if (cit != end()) if (cit != end())
{ {
@ -339,7 +339,7 @@ bool Foam::StaticHashTable<T, Key, Hash>::erase(const iterator& cit)
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
bool Foam::StaticHashTable<T, Key, Hash>::erase(const Key& key) bool Foam::ListHashTable<T, Key, Hash>::erase(const Key& key)
{ {
iterator it = find(key); iterator it = find(key);
@ -355,9 +355,9 @@ bool Foam::StaticHashTable<T, Key, Hash>::erase(const Key& key)
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
Foam::label Foam::StaticHashTable<T, Key, Hash>::erase Foam::label Foam::ListHashTable<T, Key, Hash>::erase
( (
const StaticHashTable<T, Key, Hash>& rhs const ListHashTable<T, Key, Hash>& rhs
) )
{ {
label count = 0; label count = 0;
@ -377,9 +377,9 @@ Foam::label Foam::StaticHashTable<T, Key, Hash>::erase
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
void Foam::StaticHashTable<T, Key, Hash>::resize(const label sz) void Foam::ListHashTable<T, Key, Hash>::resize(const label sz)
{ {
label newSize = StaticHashTableCore::canonicalSize(sz); label newSize = ListHashTableCore::canonicalSize(sz);
if (newSize == keys_.size()) if (newSize == keys_.size())
{ {
@ -396,12 +396,12 @@ void Foam::StaticHashTable<T, Key, Hash>::resize(const label sz)
if (newSize < 1) if (newSize < 1)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Illegal size " << newSize << " for StaticHashTable." << "Illegal size " << newSize << " for ListHashTable."
<< " Minimum size is 1" << abort(FatalError); << " Minimum size is 1" << abort(FatalError);
} }
StaticHashTable<T, Key, Hash> newTable(newSize); ListHashTable<T, Key, Hash> newTable(newSize);
for (const_iterator iter = cbegin(); iter != cend(); ++iter) for (const_iterator iter = cbegin(); iter != cend(); ++iter)
{ {
@ -417,7 +417,7 @@ void Foam::StaticHashTable<T, Key, Hash>::resize(const label sz)
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
void Foam::StaticHashTable<T, Key, Hash>::clear() void Foam::ListHashTable<T, Key, Hash>::clear()
{ {
forAll(keys_, hashIdx) forAll(keys_, hashIdx)
{ {
@ -430,7 +430,7 @@ void Foam::StaticHashTable<T, Key, Hash>::clear()
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
void Foam::StaticHashTable<T, Key, Hash>::clearStorage() void Foam::ListHashTable<T, Key, Hash>::clearStorage()
{ {
clear(); clear();
resize(1); resize(1);
@ -438,9 +438,9 @@ void Foam::StaticHashTable<T, Key, Hash>::clearStorage()
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
void Foam::StaticHashTable<T, Key, Hash>::transfer void Foam::ListHashTable<T, Key, Hash>::transfer
( (
StaticHashTable<T, Key, Hash>& ht ListHashTable<T, Key, Hash>& ht
) )
{ {
// Remove existing elements // Remove existing elements
@ -465,9 +465,9 @@ void Foam::StaticHashTable<T, Key, Hash>::transfer
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
void Foam::StaticHashTable<T, Key, Hash>::operator= void Foam::ListHashTable<T, Key, Hash>::operator=
( (
const StaticHashTable<T, Key, Hash>& rhs const ListHashTable<T, Key, Hash>& rhs
) )
{ {
// Check for assignment to self // Check for assignment to self
@ -502,10 +502,29 @@ void Foam::StaticHashTable<T, Key, Hash>::operator=
} }
} }
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
bool Foam::StaticHashTable<T, Key, Hash>::operator== void Foam::ListHashTable<T, Key, Hash>::operator=
( (
const StaticHashTable<T, Key, Hash>& rhs ListHashTable<T, Key, Hash>&& rhs
)
{
// Check for assignment to self
if (this == &rhs)
{
FatalErrorInFunction
<< "attempted assignment to self"
<< abort(FatalError);
}
transfer(rhs);
}
template<class T, class Key, class Hash>
bool Foam::ListHashTable<T, Key, Hash>::operator==
(
const ListHashTable<T, Key, Hash>& rhs
) const ) const
{ {
// Sizes (number of keys) must match // Sizes (number of keys) must match
@ -525,9 +544,9 @@ bool Foam::StaticHashTable<T, Key, Hash>::operator==
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
bool Foam::StaticHashTable<T, Key, Hash>::operator!= bool Foam::ListHashTable<T, Key, Hash>::operator!=
( (
const StaticHashTable<T, Key, Hash>& rhs const ListHashTable<T, Key, Hash>& rhs
) const ) const
{ {
return !(operator==(rhs)); return !(operator==(rhs));
@ -536,7 +555,7 @@ bool Foam::StaticHashTable<T, Key, Hash>::operator!=
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
#include "StaticHashTableIO.C" #include "ListHashTableIO.C"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -22,30 +22,28 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::StaticHashTable Foam::ListHashTable
Description Description
STL conforming hash table. STL conforming hash table using contiguous lists rather than linked lists.
Note Note
Uses straight lists as underlying type.
Is slower to insert than the standard HashTable, but should be more Is slower to insert than the standard HashTable, but should be more
memory efficient and faster to access. memory efficient and faster to access.
SourceFiles SourceFiles
StaticHashTableI.H ListHashTableI.H
StaticHashTable.C ListHashTable.C
StaticHashTableIO.C ListHashTableIO.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef StaticHashTable_H #ifndef ListHashTable_H
#define StaticHashTable_H #define ListHashTable_H
#include "label.H" #include "label.H"
#include "uLabel.H" #include "uLabel.H"
#include "word.H" #include "word.H"
#include "Xfer.H"
#include "className.H" #include "className.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,37 +54,37 @@ namespace Foam
// Forward declaration of friend functions and operators // Forward declaration of friend functions and operators
template<class T> class List; template<class T> class List;
template<class T, class Key, class Hash> class StaticHashTable; template<class T, class Key, class Hash> class ListHashTable;
template<class T, class Key, class Hash> Istream& operator>> template<class T, class Key, class Hash> Istream& operator>>
( (
Istream&, Istream&,
StaticHashTable<T, Key, Hash>& ListHashTable<T, Key, Hash>&
); );
template<class T, class Key, class Hash> Ostream& operator<< template<class T, class Key, class Hash> Ostream& operator<<
( (
Ostream&, Ostream&,
const StaticHashTable<T, Key, Hash>& const ListHashTable<T, Key, Hash>&
); );
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class StaticHashTableCore Declaration Class ListHashTableCore Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
//- Template-invariant bits for StaticHashTable //- Template-invariant bits for ListHashTable
struct StaticHashTableCore struct ListHashTableCore
{ {
//- Return a canonical (power-of-two) size //- Return a canonical (power-of-two) size
static label canonicalSize(const label); static label canonicalSize(const label);
//- Construct null //- Construct null
StaticHashTableCore() ListHashTableCore()
{} {}
//- Define template name and debug //- Define template name and debug
ClassName("StaticHashTable"); ClassName("ListHashTable");
//- A zero-sized end iterator //- A zero-sized end iterator
struct iteratorEnd struct iteratorEnd
@ -100,13 +98,13 @@ struct StaticHashTableCore
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class StaticHashTable Declaration Class ListHashTable Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class T, class Key=word, class Hash=string::hash> template<class T, class Key=word, class Hash=string::hash>
class StaticHashTable class ListHashTable
: :
public StaticHashTableCore public ListHashTableCore
{ {
// Private data type for table entries // Private data type for table entries
@ -141,13 +139,13 @@ public:
typedef Iterator typedef Iterator
< <
T&, T&,
StaticHashTable<T, Key, Hash>& ListHashTable<T, Key, Hash>&
> iterator; > iterator;
typedef Iterator typedef Iterator
< <
const T&, const T&,
const StaticHashTable<T, Key, Hash>& const ListHashTable<T, Key, Hash>&
> const_iterator; > const_iterator;
@ -156,33 +154,33 @@ public:
friend class Iterator friend class Iterator
< <
T&, T&,
StaticHashTable<T, Key, Hash>& ListHashTable<T, Key, Hash>&
>; >;
friend class Iterator friend class Iterator
< <
const T&, const T&,
const StaticHashTable<T, Key, Hash>& const ListHashTable<T, Key, Hash>&
>; >;
// Constructors // Constructors
//- Construct given initial table size //- Construct given initial table size
StaticHashTable(const label size = 128); ListHashTable(const label size = 128);
//- Construct from Istream //- Construct from Istream
StaticHashTable(Istream&, const label size = 128); ListHashTable(Istream&, const label size = 128);
//- Construct as copy //- Construct as copy
StaticHashTable(const StaticHashTable<T, Key, Hash>&); ListHashTable(const ListHashTable<T, Key, Hash>&);
//- Construct by transferring the parameter contents //- Move constructor
StaticHashTable(const Xfer<StaticHashTable<T, Key, Hash>>&); ListHashTable(ListHashTable<T, Key, Hash>&&);
//- Destructor //- Destructor
~StaticHashTable(); ~ListHashTable();
// Member Functions // Member Functions
@ -232,7 +230,7 @@ public:
//- Remove entries in the given hash table from this hash table //- Remove entries in the given hash table from this hash table
// Return the number of elements removed // Return the number of elements removed
label erase(const StaticHashTable<T, Key, Hash>&); label erase(const ListHashTable<T, Key, Hash>&);
//- Clear all entries from table //- Clear all entries from table
void clear(); void clear();
@ -243,10 +241,7 @@ public:
//- Transfer the contents of the argument table into this table //- Transfer the contents of the argument table into this table
// and annul the argument table. // and annul the argument table.
void transfer(StaticHashTable<T, Key, Hash>&); void transfer(ListHashTable<T, Key, Hash>&);
//- Transfer contents to the Xfer container
inline Xfer<StaticHashTable<T, Key, Hash>> xfer();
// Member Operators // Member Operators
@ -260,32 +255,35 @@ public:
//- Find and return an hashed entry, create it null if not present. //- Find and return an hashed entry, create it null if not present.
inline T& operator()(const Key&); inline T& operator()(const Key&);
//- Assignment //- Assignment operator
void operator=(const StaticHashTable<T, Key, Hash>&); void operator=(const ListHashTable<T, Key, Hash>&);
//- Move assignment operator
void operator=(ListHashTable<T, Key, Hash>&&);
//- Equality. Two hash tables are equal if all contents of first are //- Equality. Two hash tables are equal if all contents of first are
// also in second and vice versa. // also in second and vice versa.
bool operator==(const StaticHashTable<T, Key, Hash>&) const; bool operator==(const ListHashTable<T, Key, Hash>&) const;
//- The opposite of the equality operation. //- The opposite of the equality operation.
bool operator!=(const StaticHashTable<T, Key, Hash>&) const; bool operator!=(const ListHashTable<T, Key, Hash>&) const;
// STL type definitions // STL type definitions
//- Type of values the StaticHashTable contains. //- Type of values the ListHashTable contains.
typedef T value_type; typedef T value_type;
//- Type that can be used for storing into StaticHashTable::value_type //- Type that can be used for storing into ListHashTable::value_type
// objects. This type is usually List::value_type&. // objects. This type is usually List::value_type&.
typedef T& reference; typedef T& reference;
//- Type that can be used for storing into constant //- Type that can be used for storing into constant
// StaticHashTable::value_type objects. This type is usually const // ListHashTable::value_type objects. This type is usually const
// StaticHashTable::value_type&. // ListHashTable::value_type&.
typedef const T& const_reference; typedef const T& const_reference;
//- The type that can represent the size of a StaticHashTable. //- The type that can represent the size of a ListHashTable.
typedef label size_type; typedef label size_type;
@ -295,14 +293,14 @@ public:
template<class TRef, class TableRef> template<class TRef, class TableRef>
class Iterator class Iterator
{ {
friend class StaticHashTable; friend class ListHashTable;
template<class TRef2, class TableRef2> template<class TRef2, class TableRef2>
friend class Iterator; friend class Iterator;
// Private data // Private data
//- Reference to the StaticHashTable this is an iterator for //- Reference to the ListHashTable this is an iterator for
TableRef hashTable_; TableRef hashTable_;
//- Current hash index //- Current hash index
@ -348,22 +346,22 @@ public:
}; };
//- Iterator set to the beginning of the StaticHashTable //- Iterator set to the beginning of the ListHashTable
inline iterator begin(); inline iterator begin();
//- Iterator set to beyond the end of the StaticHashTable //- Iterator set to beyond the end of the ListHashTable
inline const iterator& end(); inline const iterator& end();
//- const_iterator set to the beginning of the StaticHashTable //- const_iterator set to the beginning of the ListHashTable
inline const_iterator cbegin() const; inline const_iterator cbegin() const;
//- const_iterator set to beyond the end of the StaticHashTable //- const_iterator set to beyond the end of the ListHashTable
inline const const_iterator& cend() const; inline const const_iterator& cend() const;
//- const_iterator set to the beginning of the StaticHashTable //- const_iterator set to the beginning of the ListHashTable
inline const_iterator begin() const; inline const_iterator begin() const;
//- const_iterator set to beyond the end of the StaticHashTable //- const_iterator set to beyond the end of the ListHashTable
inline const const_iterator& end() const; inline const const_iterator& end() const;
// IOstream Operator // IOstream Operator
@ -371,13 +369,13 @@ public:
friend Istream& operator>> <T, Key, Hash> friend Istream& operator>> <T, Key, Hash>
( (
Istream&, Istream&,
StaticHashTable<T, Key, Hash>& ListHashTable<T, Key, Hash>&
); );
friend Ostream& operator<< <T, Key, Hash> friend Ostream& operator<< <T, Key, Hash>
( (
Ostream&, Ostream&,
const StaticHashTable<T, Key, Hash>& const ListHashTable<T, Key, Hash>&
); );
@ -397,13 +395,13 @@ private:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "StaticHashTableI.H" #include "ListHashTableI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifndef NoStaticHashTableC #ifndef NoListHashTableC
#ifdef NoRepository #ifdef NoRepository
#include "StaticHashTable.C" #include "ListHashTable.C"
#endif #endif
#endif #endif

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,13 +23,13 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "StaticHashTable.H" #include "ListHashTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(StaticHashTableCore, 0); defineTypeNameAndDebug(ListHashTableCore, 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 | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,16 +23,13 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "error.H"
#include "IOstreams.H" #include "IOstreams.H"
// * * * * * * * * * * * * * Private Member Classes * * * * * * * * * * * * //
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline Foam::label inline Foam::label
Foam::StaticHashTable<T, Key, Hash>::hashKeyIndex(const Key& key) const Foam::ListHashTable<T, Key, Hash>::hashKeyIndex(const Key& key) const
{ {
// size is power of two - this is the modulus // size is power of two - this is the modulus
return Hash()(key) & (keys_.size() - 1); return Hash()(key) & (keys_.size() - 1);
@ -42,21 +39,21 @@ Foam::StaticHashTable<T, Key, Hash>::hashKeyIndex(const Key& key) const
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline Foam::label Foam::StaticHashTable<T, Key, Hash>::size() const inline Foam::label Foam::ListHashTable<T, Key, Hash>::size() const
{ {
return nElmts_; return nElmts_;
} }
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline bool Foam::StaticHashTable<T, Key, Hash>::empty() const inline bool Foam::ListHashTable<T, Key, Hash>::empty() const
{ {
return !nElmts_; return !nElmts_;
} }
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline bool Foam::StaticHashTable<T, Key, Hash>::insert inline bool Foam::ListHashTable<T, Key, Hash>::insert
( (
const Key& key, const Key& key,
const T& newEntry const T& newEntry
@ -67,7 +64,7 @@ inline bool Foam::StaticHashTable<T, Key, Hash>::insert
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline bool Foam::StaticHashTable<T, Key, Hash>::set inline bool Foam::ListHashTable<T, Key, Hash>::set
( (
const Key& key, const Key& key,
const T& newEntry const T& newEntry
@ -77,18 +74,10 @@ inline bool Foam::StaticHashTable<T, Key, Hash>::set
} }
template<class T, class Key, class Hash>
inline Foam::Xfer<Foam::StaticHashTable<T, Key, Hash>>
Foam::StaticHashTable<T, Key, Hash>::xfer()
{
return xferMove(*this);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline T& Foam::StaticHashTable<T, Key, Hash>::operator[](const Key& key) inline T& Foam::ListHashTable<T, Key, Hash>::operator[](const Key& key)
{ {
iterator iter = find(key); iterator iter = find(key);
@ -104,7 +93,7 @@ inline T& Foam::StaticHashTable<T, Key, Hash>::operator[](const Key& key)
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline const T& Foam::StaticHashTable<T, Key, Hash>::operator[] inline const T& Foam::ListHashTable<T, Key, Hash>::operator[]
( (
const Key& key const Key& key
) const ) const
@ -123,7 +112,7 @@ inline const T& Foam::StaticHashTable<T, Key, Hash>::operator[]
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline T& Foam::StaticHashTable<T, Key, Hash>::operator()(const Key& key) inline T& Foam::ListHashTable<T, Key, Hash>::operator()(const Key& key)
{ {
iterator iter = find(key); iterator iter = find(key);
@ -143,7 +132,7 @@ inline T& Foam::StaticHashTable<T, Key, Hash>::operator()(const Key& key)
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
template<class TRef, class TableRef> template<class TRef, class TableRef>
inline Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::Iterator inline Foam::ListHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::Iterator
( (
TableRef hashTbl, TableRef hashTbl,
label hashIndex, label hashIndex,
@ -158,7 +147,7 @@ inline Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::Iterator
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
template<class TRef, class TableRef> template<class TRef, class TableRef>
inline Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::Iterator inline Foam::ListHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::Iterator
( (
const iterator& iter const iterator& iter
) )
@ -172,7 +161,7 @@ inline Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::Iterator
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
template<class TRef, class TableRef> template<class TRef, class TableRef>
inline void inline void
Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator= Foam::ListHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator=
( (
const iterator& iter const iterator& iter
) )
@ -185,7 +174,7 @@ Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator=
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
template<class TRef, class TableRef> template<class TRef, class TableRef>
inline bool inline bool
Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator== Foam::ListHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator==
( (
const iterator& iter const iterator& iter
) const ) const
@ -197,7 +186,7 @@ Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator==
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
template<class TRef, class TableRef> template<class TRef, class TableRef>
inline bool inline bool
Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator== Foam::ListHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator==
( (
const const_iterator& iter const const_iterator& iter
) const ) const
@ -209,7 +198,7 @@ Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator==
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
template<class TRef, class TableRef> template<class TRef, class TableRef>
inline bool inline bool
Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator!= Foam::ListHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator!=
( (
const iterator& iter const iterator& iter
) const ) const
@ -221,7 +210,7 @@ Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator!=
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
template<class TRef, class TableRef> template<class TRef, class TableRef>
inline bool inline bool
Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator!= Foam::ListHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator!=
( (
const const_iterator& iter const const_iterator& iter
) const ) const
@ -233,7 +222,7 @@ Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator!=
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
template<class TRef, class TableRef> template<class TRef, class TableRef>
inline TRef inline TRef
Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator*() Foam::ListHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator*()
{ {
return hashTable_.objects_[hashIndex_][elemIndex_]; return hashTable_.objects_[hashIndex_][elemIndex_];
} }
@ -242,7 +231,7 @@ Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator*()
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
template<class TRef, class TableRef> template<class TRef, class TableRef>
inline TRef inline TRef
Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator()() Foam::ListHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator()()
{ {
return operator*(); return operator*();
} }
@ -251,12 +240,12 @@ Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator()()
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
template<class TRef, class TableRef> template<class TRef, class TableRef>
inline inline
typename Foam::StaticHashTable<T, Key, Hash>::template Iterator typename Foam::ListHashTable<T, Key, Hash>::template Iterator
< <
TRef, TRef,
TableRef TableRef
>& >&
Foam::StaticHashTable<T, Key, Hash>::Iterator Foam::ListHashTable<T, Key, Hash>::Iterator
< <
TRef, TRef,
TableRef TableRef
@ -303,12 +292,12 @@ Foam::StaticHashTable<T, Key, Hash>::Iterator
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
template<class TRef, class TableRef> template<class TRef, class TableRef>
inline inline
typename Foam::StaticHashTable<T, Key, Hash>::template Iterator typename Foam::ListHashTable<T, Key, Hash>::template Iterator
< <
TRef, TRef,
TableRef TableRef
> >
Foam::StaticHashTable<T, Key, Hash>::Iterator Foam::ListHashTable<T, Key, Hash>::Iterator
< <
TRef, TRef,
TableRef TableRef
@ -326,15 +315,15 @@ Foam::StaticHashTable<T, Key, Hash>::Iterator
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
template<class TRef, class TableRef> template<class TRef, class TableRef>
inline const Key& inline const Key&
Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::key() const Foam::ListHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::key() const
{ {
return hashTable_.keys_[hashIndex_][elemIndex_]; return hashTable_.keys_[hashIndex_][elemIndex_];
} }
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline typename Foam::StaticHashTable<T, Key, Hash>::iterator inline typename Foam::ListHashTable<T, Key, Hash>::iterator
Foam::StaticHashTable<T, Key, Hash>::begin() Foam::ListHashTable<T, Key, Hash>::begin()
{ {
// Find first non-empty entry // Find first non-empty entry
forAll(keys_, hashIdx) forAll(keys_, hashIdx)
@ -348,25 +337,25 @@ Foam::StaticHashTable<T, Key, Hash>::begin()
#ifdef FULLDEBUG #ifdef FULLDEBUG
if (debug) if (debug)
{ {
Info<< "StaticHashTable is empty\n"; Info<< "ListHashTable is empty\n";
} }
#endif #endif
return StaticHashTable<T, Key, Hash>::endIter_; return ListHashTable<T, Key, Hash>::endIter_;
} }
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline const typename Foam::StaticHashTable<T, Key, Hash>::iterator& inline const typename Foam::ListHashTable<T, Key, Hash>::iterator&
Foam::StaticHashTable<T, Key, Hash>::end() Foam::ListHashTable<T, Key, Hash>::end()
{ {
return StaticHashTable<T, Key, Hash>::endIter_; return ListHashTable<T, Key, Hash>::endIter_;
} }
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline typename Foam::StaticHashTable<T, Key, Hash>::const_iterator inline typename Foam::ListHashTable<T, Key, Hash>::const_iterator
Foam::StaticHashTable<T, Key, Hash>::cbegin() const Foam::ListHashTable<T, Key, Hash>::cbegin() const
{ {
// Find first non-empty entry // Find first non-empty entry
forAll(keys_, hashIdx) forAll(keys_, hashIdx)
@ -380,35 +369,35 @@ Foam::StaticHashTable<T, Key, Hash>::cbegin() const
#ifdef FULLDEBUG #ifdef FULLDEBUG
if (debug) if (debug)
{ {
Info<< "StaticHashTable is empty\n"; Info<< "ListHashTable is empty\n";
} }
#endif #endif
return StaticHashTable<T, Key, Hash>::endConstIter_; return ListHashTable<T, Key, Hash>::endConstIter_;
} }
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline const typename Foam::StaticHashTable<T, Key, Hash>::const_iterator& inline const typename Foam::ListHashTable<T, Key, Hash>::const_iterator&
Foam::StaticHashTable<T, Key, Hash>::cend() const Foam::ListHashTable<T, Key, Hash>::cend() const
{ {
return StaticHashTable<T, Key, Hash>::endConstIter_; return ListHashTable<T, Key, Hash>::endConstIter_;
} }
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline typename Foam::StaticHashTable<T, Key, Hash>::const_iterator inline typename Foam::ListHashTable<T, Key, Hash>::const_iterator
Foam::StaticHashTable<T, Key, Hash>::begin() const Foam::ListHashTable<T, Key, Hash>::begin() const
{ {
return this->cbegin(); return this->cbegin();
} }
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline const typename Foam::StaticHashTable<T, Key, Hash>::const_iterator& inline const typename Foam::ListHashTable<T, Key, Hash>::const_iterator&
Foam::StaticHashTable<T, Key, Hash>::end() const Foam::ListHashTable<T, Key, Hash>::end() const
{ {
return StaticHashTable<T, Key, Hash>::endConstIter_; return ListHashTable<T, Key, Hash>::endConstIter_;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,22 +23,22 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "StaticHashTable.H" #include "ListHashTable.H"
#include "Istream.H" #include "Istream.H"
#include "Ostream.H" #include "Ostream.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
Foam::StaticHashTable<T, Key, Hash>::StaticHashTable Foam::ListHashTable<T, Key, Hash>::ListHashTable
( (
Istream& is, Istream& is,
const label size const label size
) )
: :
StaticHashTableCore(), ListHashTableCore(),
keys_(StaticHashTableCore::canonicalSize(size)), keys_(ListHashTableCore::canonicalSize(size)),
objects_(StaticHashTableCore::canonicalSize(size)), objects_(ListHashTableCore::canonicalSize(size)),
nElmts_(0), nElmts_(0),
endIter_(*this, keys_.size(), 0), endIter_(*this, keys_.size(), 0),
endConstIter_(*this, keys_.size(), 0) endConstIter_(*this, keys_.size(), 0)
@ -46,7 +46,7 @@ Foam::StaticHashTable<T, Key, Hash>::StaticHashTable
if (size < 1) if (size < 1)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Illegal size " << size << " for StaticHashTable." << "Illegal size " << size << " for ListHashTable."
<< " Minimum size is 1" << abort(FatalError); << " Minimum size is 1" << abort(FatalError);
} }
@ -58,7 +58,7 @@ Foam::StaticHashTable<T, Key, Hash>::StaticHashTable
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
Foam::Ostream& Foam::Ostream&
Foam::StaticHashTable<T, Key, Hash>::printInfo(Ostream& os) const Foam::ListHashTable<T, Key, Hash>::printInfo(Ostream& os) const
{ {
label used = 0; label used = 0;
label maxChain = 0; label maxChain = 0;
@ -80,7 +80,7 @@ Foam::StaticHashTable<T, Key, Hash>::printInfo(Ostream& os) const
} }
} }
os << "StaticHashTable<T,Key,Hash>" os << "ListHashTable<T,Key,Hash>"
<< " elements:" << size() << " slots:" << used << "/" << keys_.size() << " elements:" << size() << " slots:" << used << "/" << keys_.size()
<< " chaining(avg/max):" << (used ? float(avgChain/used) : 0) << " chaining(avg/max):" << (used ? float(avgChain/used) : 0)
<< "/" << maxChain << endl; << "/" << maxChain << endl;
@ -92,20 +92,20 @@ Foam::StaticHashTable<T, Key, Hash>::printInfo(Ostream& os) const
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
Foam::Istream& Foam::operator>>(Istream& is, StaticHashTable<T, Key, Hash>& L) Foam::Istream& Foam::operator>>(Istream& is, ListHashTable<T, Key, Hash>& L)
{ {
is.fatalCheck("operator>>(Istream&, StaticHashTable<T, Key, Hash>&)"); is.fatalCheck("operator>>(Istream&, ListHashTable<T, Key, Hash>&)");
// Anull list // Anull list
L.clear(); L.clear();
is.fatalCheck("operator>>(Istream&, StaticHashTable<T, Key, Hash>&)"); is.fatalCheck("operator>>(Istream&, ListHashTable<T, Key, Hash>&)");
token firstToken(is); token firstToken(is);
is.fatalCheck is.fatalCheck
( (
"operator>>(Istream&, StaticHashTable<T, Key, Hash>&) : " "operator>>(Istream&, ListHashTable<T, Key, Hash>&) : "
"reading first token" "reading first token"
); );
@ -114,7 +114,7 @@ Foam::Istream& Foam::operator>>(Istream& is, StaticHashTable<T, Key, Hash>& L)
label s = firstToken.labelToken(); label s = firstToken.labelToken();
// Read beginning of contents // Read beginning of contents
char delimiter = is.readBeginList("StaticHashTable<T, Key, Hash>"); char delimiter = is.readBeginList("ListHashTable<T, Key, Hash>");
if (s) if (s)
{ {
@ -133,7 +133,7 @@ Foam::Istream& Foam::operator>>(Istream& is, StaticHashTable<T, Key, Hash>& L)
is.fatalCheck is.fatalCheck
( (
"operator>>(Istream&, StaticHashTable<T, Key, Hash>&)" "operator>>(Istream&, ListHashTable<T, Key, Hash>&)"
" : reading entry" " : reading entry"
); );
} }
@ -149,7 +149,7 @@ Foam::Istream& Foam::operator>>(Istream& is, StaticHashTable<T, Key, Hash>& L)
} }
// Read end of contents // Read end of contents
is.readEndList("StaticHashTable"); is.readEndList("ListHashTable");
} }
else if (firstToken.isPunctuation()) else if (firstToken.isPunctuation())
{ {
@ -183,7 +183,7 @@ Foam::Istream& Foam::operator>>(Istream& is, StaticHashTable<T, Key, Hash>& L)
is.fatalCheck is.fatalCheck
( (
"operator>>(Istream&, StaticHashTable<T, Key, Hash>&) : " "operator>>(Istream&, ListHashTable<T, Key, Hash>&) : "
"reading entry" "reading entry"
); );
@ -200,7 +200,7 @@ Foam::Istream& Foam::operator>>(Istream& is, StaticHashTable<T, Key, Hash>& L)
<< exit(FatalIOError); << exit(FatalIOError);
} }
is.fatalCheck("operator>>(Istream&, StaticHashTable<T, Key, Hash>&)"); is.fatalCheck("operator>>(Istream&, ListHashTable<T, Key, Hash>&)");
return is; return is;
} }
@ -210,7 +210,7 @@ template<class T, class Key, class Hash>
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<
( (
Ostream& os, Ostream& os,
const StaticHashTable<T, Key, Hash>& L) const ListHashTable<T, Key, Hash>& L)
{ {
// Write size and start delimiter // Write size and start delimiter
os << nl << L.size() << nl << token::BEGIN_LIST << nl; os << nl << L.size() << nl << token::BEGIN_LIST << nl;
@ -218,7 +218,7 @@ Foam::Ostream& Foam::operator<<
// Write contents // Write contents
for for
( (
typename StaticHashTable<T, Key, Hash>::const_iterator iter = L.begin(); typename ListHashTable<T, Key, Hash>::const_iterator iter = L.begin();
iter != L.end(); iter != L.end();
++iter ++iter
) )
@ -230,7 +230,7 @@ Foam::Ostream& Foam::operator<<
os << token::END_LIST; os << token::END_LIST;
// Check state of IOstream // Check state of IOstream
os.check("Ostream& operator<<(Ostream&, const StaticHashTable&)"); os.check("Ostream& operator<<(Ostream&, const ListHashTable&)");
return os; return os;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -73,22 +73,22 @@ public:
HashTable<T, label, Hash<label>>(is) HashTable<T, label, Hash<label>>(is)
{} {}
//- Construct as copy //- Copy constructor
Map(const Map<T>& map) Map(const Map<T>& map)
: :
HashTable<T, label, Hash<label>>(map) HashTable<T, label, Hash<label>>(map)
{} {}
//- Construct by transferring the parameter contents //- Move constructor
Map(const Xfer<Map<T>>& map) Map(Map<T>&& map)
: :
HashTable<T, label, Hash<label>>(map) HashTable<T, label, Hash<label>>(move(map))
{} {}
//- Construct by transferring the parameter contents //- Move constructor
Map(const Xfer<HashTable<T, label, Hash<label>>>& map) Map(HashTable<T, label, Hash<label>>&& map)
: :
HashTable<T, label, Hash<label>>(map) HashTable<T, label, Hash<label>>(move(map))
{} {}
//- Construct from an initializer list //- Construct from an initializer list
@ -96,6 +96,19 @@ public:
: :
HashTable<T, label, Hash<label>>(map) HashTable<T, label, Hash<label>>(map)
{} {}
// Member operators
void operator=(const Map<T>& map)
{
HashTable<T, label, Hash<label>>::operator=(map);
}
void operator=(Map<T>&& map)
{
HashTable<T, label, Hash<label>>::operator=(move(map));
}
}; };

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