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:
@ -25,10 +25,10 @@ fvMesh mesh
|
||||
runTime,
|
||||
IOobject::READ_IF_PRESENT
|
||||
),
|
||||
xferMove<Field<vector>>(points),
|
||||
faces.xfer(),
|
||||
owner.xfer(),
|
||||
neighbour.xfer()
|
||||
move(points),
|
||||
move(faces),
|
||||
move(owner),
|
||||
move(neighbour)
|
||||
);
|
||||
|
||||
List<polyPatch*> patches(1);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -261,7 +261,7 @@ Foam::InterfaceCompositionPhaseChangePhaseSystem<BasePhaseSystem>::dmdt
|
||||
|
||||
|
||||
template<class BasePhaseSystem>
|
||||
Foam::Xfer<Foam::PtrList<Foam::volScalarField>>
|
||||
Foam::PtrList<Foam::volScalarField>
|
||||
Foam::InterfaceCompositionPhaseChangePhaseSystem<BasePhaseSystem>::dmdts() const
|
||||
{
|
||||
PtrList<volScalarField> dmdts(BasePhaseSystem::dmdts());
|
||||
@ -302,7 +302,7 @@ Foam::InterfaceCompositionPhaseChangePhaseSystem<BasePhaseSystem>::dmdts() const
|
||||
}
|
||||
}
|
||||
|
||||
return dmdts.xfer();
|
||||
return dmdts;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -133,7 +133,7 @@ public:
|
||||
virtual tmp<volScalarField> dmdt(const phasePairKey& key) const;
|
||||
|
||||
//- Return the mass transfer rates for each phase
|
||||
virtual Xfer<PtrList<volScalarField>> dmdts() const;
|
||||
virtual PtrList<volScalarField> dmdts() const;
|
||||
|
||||
//- Return the mass transfer matrices
|
||||
virtual autoPtr<phaseSystem::massTransferTable> massTransfer() const;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -451,7 +451,7 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::momentumTransferf()
|
||||
|
||||
|
||||
template<class BasePhaseSystem>
|
||||
Foam::Xfer<Foam::PtrList<Foam::surfaceScalarField>>
|
||||
Foam::PtrList<Foam::surfaceScalarField>
|
||||
Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::AFfs() const
|
||||
{
|
||||
PtrList<surfaceScalarField> AFfs(this->phaseModels_.size());
|
||||
@ -485,12 +485,12 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::AFfs() const
|
||||
this->fillFields("AFf", dimDensity/dimTime, AFfs);
|
||||
}
|
||||
|
||||
return AFfs.xfer();
|
||||
return AFfs;
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseSystem>
|
||||
Foam::Xfer<Foam::PtrList<Foam::surfaceScalarField>>
|
||||
Foam::PtrList<Foam::surfaceScalarField>
|
||||
Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiFs
|
||||
(
|
||||
const PtrList<volScalarField>& rAUs
|
||||
@ -626,12 +626,12 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiFs
|
||||
this->fillFields("phiF", dimForce/dimDensity/dimVelocity, phiFs);
|
||||
}
|
||||
|
||||
return phiFs.xfer();
|
||||
return phiFs;
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseSystem>
|
||||
Foam::Xfer<Foam::PtrList<Foam::surfaceScalarField>>
|
||||
Foam::PtrList<Foam::surfaceScalarField>
|
||||
Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiFfs
|
||||
(
|
||||
const PtrList<surfaceScalarField>& rAUfs
|
||||
@ -789,12 +789,12 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiFfs
|
||||
this->fillFields("phiFf", dimForce/dimDensity/dimVelocity, phiFfs);
|
||||
}
|
||||
|
||||
return phiFfs.xfer();
|
||||
return phiFfs;
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseSystem>
|
||||
Foam::Xfer<Foam::PtrList<Foam::surfaceScalarField>>
|
||||
Foam::PtrList<Foam::surfaceScalarField>
|
||||
Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiKdPhis
|
||||
(
|
||||
const PtrList<volScalarField>& rAUs
|
||||
@ -831,12 +831,12 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiKdPhis
|
||||
);
|
||||
}
|
||||
|
||||
return phiKdPhis.xfer();
|
||||
return phiKdPhis;
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseSystem>
|
||||
Foam::Xfer<Foam::PtrList<Foam::surfaceScalarField>>
|
||||
Foam::PtrList<Foam::surfaceScalarField>
|
||||
Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiKdPhifs
|
||||
(
|
||||
const PtrList<surfaceScalarField>& rAUfs
|
||||
@ -873,12 +873,12 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiKdPhifs
|
||||
);
|
||||
}
|
||||
|
||||
return phiKdPhifs.xfer();
|
||||
return phiKdPhifs;
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseSystem>
|
||||
Foam::Xfer<Foam::PtrList<Foam::volVectorField>>
|
||||
Foam::PtrList<Foam::volVectorField>
|
||||
Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::KdUByAs
|
||||
(
|
||||
const PtrList<volScalarField>& rAUs
|
||||
@ -909,12 +909,12 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::KdUByAs
|
||||
this->fillFields("KdUByA", dimVelocity, KdUByAs);
|
||||
}
|
||||
|
||||
return KdUByAs.xfer();
|
||||
return KdUByAs;
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseSystem>
|
||||
Foam::Xfer<Foam::PtrList<Foam::surfaceScalarField>>
|
||||
Foam::PtrList<Foam::surfaceScalarField>
|
||||
Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::ddtCorrByAs
|
||||
(
|
||||
const PtrList<volScalarField>& rAUs,
|
||||
@ -1009,7 +1009,7 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::ddtCorrByAs
|
||||
}
|
||||
}
|
||||
|
||||
return ddtCorrByAs.xfer();
|
||||
return ddtCorrByAs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -212,19 +212,19 @@ public:
|
||||
|
||||
//- Return implicit force coefficients on the faces, for the face-based
|
||||
// algorithm.
|
||||
virtual Xfer<PtrList<surfaceScalarField>> AFfs() const;
|
||||
virtual PtrList<surfaceScalarField> AFfs() const;
|
||||
|
||||
//- Return the explicit force fluxes for the cell-based algorithm, that
|
||||
// do not depend on phase mass/volume fluxes, and can therefore be
|
||||
// evaluated outside the corrector loop. This includes things like
|
||||
// lift, turbulent dispersion, and wall lubrication.
|
||||
virtual Xfer<PtrList<surfaceScalarField>> phiFs
|
||||
virtual PtrList<surfaceScalarField> phiFs
|
||||
(
|
||||
const PtrList<volScalarField>& rAUs
|
||||
);
|
||||
|
||||
//- As phiFs, but for the face-based algorithm
|
||||
virtual Xfer<PtrList<surfaceScalarField>> phiFfs
|
||||
virtual PtrList<surfaceScalarField> phiFfs
|
||||
(
|
||||
const PtrList<surfaceScalarField>& rAUfs
|
||||
);
|
||||
@ -232,13 +232,13 @@ public:
|
||||
//- Return the explicit drag force fluxes for the cell-based algorithm.
|
||||
// These depend on phase mass/volume fluxes, and must therefore be
|
||||
// evaluated inside the corrector loop.
|
||||
virtual Xfer<PtrList<surfaceScalarField>> phiKdPhis
|
||||
virtual PtrList<surfaceScalarField> phiKdPhis
|
||||
(
|
||||
const PtrList<volScalarField>& rAUs
|
||||
) const;
|
||||
|
||||
//- As phiKdPhis, but for the face-based algorithm
|
||||
virtual Xfer<PtrList<surfaceScalarField>> phiKdPhifs
|
||||
virtual PtrList<surfaceScalarField> phiKdPhifs
|
||||
(
|
||||
const PtrList<surfaceScalarField>& rAUfs
|
||||
) const;
|
||||
@ -247,7 +247,7 @@ public:
|
||||
// algorithm. This is the cell-equivalent of phiKdPhis. These depend on
|
||||
// phase velocities, and must therefore be evaluated inside the
|
||||
// corrector loop.
|
||||
virtual Xfer<PtrList<volVectorField>> KdUByAs
|
||||
virtual PtrList<volVectorField> KdUByAs
|
||||
(
|
||||
const PtrList<volScalarField>& rAUs
|
||||
) const;
|
||||
@ -268,7 +268,7 @@ public:
|
||||
//- Return the flux corrections for the cell-based algorithm. These
|
||||
// depend on phase mass/volume fluxes, and must therefore be evaluated
|
||||
// inside the corrector loop.
|
||||
virtual Xfer<PtrList<surfaceScalarField>> ddtCorrByAs
|
||||
virtual PtrList<surfaceScalarField> ddtCorrByAs
|
||||
(
|
||||
const PtrList<volScalarField>& rAUs,
|
||||
const bool includeVirtualMass = false
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -102,7 +102,7 @@ Foam::PhaseTransferPhaseSystem<BasePhaseSystem>::dmdt
|
||||
|
||||
|
||||
template<class BasePhaseSystem>
|
||||
Foam::Xfer<Foam::PtrList<Foam::volScalarField>>
|
||||
Foam::PtrList<Foam::volScalarField>
|
||||
Foam::PhaseTransferPhaseSystem<BasePhaseSystem>::dmdts() const
|
||||
{
|
||||
PtrList<volScalarField> dmdts(BasePhaseSystem::dmdts());
|
||||
@ -116,7 +116,7 @@ Foam::PhaseTransferPhaseSystem<BasePhaseSystem>::dmdts() const
|
||||
this->addField(pair.phase2(), "dmdt", - rDmdt, dmdts);
|
||||
}
|
||||
|
||||
return dmdts.xfer();
|
||||
return dmdts;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -105,7 +105,7 @@ public:
|
||||
virtual tmp<volScalarField> dmdt(const phasePairKey& key) const;
|
||||
|
||||
//- Return the mass transfer rates for each phase
|
||||
virtual Xfer<PtrList<volScalarField>> dmdts() const;
|
||||
virtual PtrList<volScalarField> dmdts() const;
|
||||
|
||||
//- Return the mass transfer matrices
|
||||
virtual autoPtr<phaseSystem::massTransferTable> massTransfer() const;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2017-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -148,7 +148,7 @@ Foam::PopulationBalancePhaseSystem<BasePhaseSystem>::dmdt
|
||||
|
||||
|
||||
template<class BasePhaseSystem>
|
||||
Foam::Xfer<Foam::PtrList<Foam::volScalarField>>
|
||||
Foam::PtrList<Foam::volScalarField>
|
||||
Foam::PopulationBalancePhaseSystem<BasePhaseSystem>::dmdts() const
|
||||
{
|
||||
PtrList<volScalarField> dmdts(BasePhaseSystem::dmdts());
|
||||
@ -162,7 +162,7 @@ Foam::PopulationBalancePhaseSystem<BasePhaseSystem>::dmdts() const
|
||||
this->addField(pair.phase2(), "dmdt", - pDmdt, dmdts);
|
||||
}
|
||||
|
||||
return dmdts.xfer();
|
||||
return dmdts;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2017-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -96,7 +96,7 @@ public:
|
||||
virtual tmp<volScalarField> dmdt(const phasePairKey& key) const;
|
||||
|
||||
//- Return the mass transfer rates for each phase
|
||||
virtual Xfer<PtrList<volScalarField>> dmdts() const;
|
||||
virtual PtrList<volScalarField> dmdts() const;
|
||||
|
||||
//- Return the mass transfer matrices
|
||||
virtual autoPtr<phaseSystem::massTransferTable> massTransfer() const;
|
||||
|
||||
@ -188,7 +188,7 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::dmdt
|
||||
|
||||
|
||||
template<class BasePhaseSystem>
|
||||
Foam::Xfer<Foam::PtrList<Foam::volScalarField>>
|
||||
Foam::PtrList<Foam::volScalarField>
|
||||
Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::dmdts() const
|
||||
{
|
||||
PtrList<volScalarField> dmdts(BasePhaseSystem::dmdts());
|
||||
@ -211,7 +211,7 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::dmdts() const
|
||||
this->addField(pair.phase2(), "dmdt", - wDmdt, dmdts);
|
||||
}
|
||||
|
||||
return dmdts.xfer();
|
||||
return dmdts;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -121,7 +121,7 @@ public:
|
||||
virtual tmp<volScalarField> dmdt(const phasePairKey& key) const;
|
||||
|
||||
//- Return the mass transfer rates for each phase
|
||||
virtual Xfer<PtrList<volScalarField>> dmdts() const;
|
||||
virtual PtrList<volScalarField> dmdts() const;
|
||||
|
||||
//- Return the heat transfer matrices
|
||||
virtual autoPtr<phaseSystem::heatTransferTable> heatTransfer() const;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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());
|
||||
|
||||
return dmdts.xfer();
|
||||
return dmdts;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -441,7 +441,7 @@ public:
|
||||
virtual tmp<volScalarField> dmdt(const phasePairKey& key) const;
|
||||
|
||||
//- Return the mass transfer rates for each phase
|
||||
virtual Xfer<PtrList<volScalarField>> dmdts() const;
|
||||
virtual PtrList<volScalarField> dmdts() const;
|
||||
|
||||
|
||||
// Transfers
|
||||
@ -456,34 +456,34 @@ public:
|
||||
|
||||
//- Return the implicit force coefficients for the face-based
|
||||
// algorithm
|
||||
virtual Xfer<PtrList<surfaceScalarField>> AFfs() const = 0;
|
||||
virtual PtrList<surfaceScalarField> AFfs() const = 0;
|
||||
|
||||
//- Return the force fluxes for the cell-based algorithm
|
||||
virtual Xfer<PtrList<surfaceScalarField>> phiFs
|
||||
virtual PtrList<surfaceScalarField> phiFs
|
||||
(
|
||||
const PtrList<volScalarField>& rAUs
|
||||
) = 0;
|
||||
|
||||
//- Return the force fluxes for the face-based algorithm
|
||||
virtual Xfer<PtrList<surfaceScalarField>> phiFfs
|
||||
virtual PtrList<surfaceScalarField> phiFfs
|
||||
(
|
||||
const PtrList<surfaceScalarField>& rAUfs
|
||||
) = 0;
|
||||
|
||||
//- Return the force fluxes for the cell-based algorithm
|
||||
virtual Xfer<PtrList<surfaceScalarField>> phiKdPhis
|
||||
virtual PtrList<surfaceScalarField> phiKdPhis
|
||||
(
|
||||
const PtrList<volScalarField>& rAUs
|
||||
) const = 0;
|
||||
|
||||
//- Return the force fluxes for the face-based algorithm
|
||||
virtual Xfer<PtrList<surfaceScalarField>> phiKdPhifs
|
||||
virtual PtrList<surfaceScalarField> phiKdPhifs
|
||||
(
|
||||
const PtrList<surfaceScalarField>& rAUfs
|
||||
) const = 0;
|
||||
|
||||
//- Return the explicit part of the drag force
|
||||
virtual Xfer<PtrList<volVectorField>> KdUByAs
|
||||
virtual PtrList<volVectorField> KdUByAs
|
||||
(
|
||||
const PtrList<volScalarField>& rAUs
|
||||
) const = 0;
|
||||
@ -501,7 +501,7 @@ public:
|
||||
) = 0;
|
||||
|
||||
//- Return the flux corrections for the cell-based algorithm
|
||||
virtual Xfer<PtrList<surfaceScalarField>> ddtCorrByAs
|
||||
virtual PtrList<surfaceScalarField> ddtCorrByAs
|
||||
(
|
||||
const PtrList<volScalarField>& rAUs,
|
||||
const bool includeVirtualMass = false
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -173,13 +173,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
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("dlC", dlC, true);
|
||||
|
||||
DynamicList<label> dlD(lstB.xfer());
|
||||
DynamicList<label> dlD(move(lstB));
|
||||
|
||||
Info<< "Transfer construct from normal list" << endl;
|
||||
printInfo("lstB", lstB, true);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -94,10 +94,10 @@ int main()
|
||||
|
||||
|
||||
HashTable<scalar> table2(table1);
|
||||
HashTable<scalar> table3(table1.xfer());
|
||||
HashTable<scalar> table3(move(table1));
|
||||
|
||||
Info<< "\ncopy table1 -> table2" << nl
|
||||
<< "transfer table1 -> table3 via the xfer() method" << nl;
|
||||
<< "move table1 -> table3" << nl;
|
||||
|
||||
Info<< "\ntable1" << table1 << nl
|
||||
<< "\ntable2" << table2 << nl
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -65,7 +65,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "table3: " << table3 << nl
|
||||
<< "toc: " << table3.toc() << endl;
|
||||
|
||||
Map<label> table4(table3.xfer());
|
||||
Map<label> table4(move(table3));
|
||||
|
||||
Info<< "table3: " << table3 << nl
|
||||
<< "toc: " << table3.toc() << endl;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -71,7 +71,7 @@ int main(int argc, char *argv[])
|
||||
addresses[1] = 8;
|
||||
addresses[0] = 5;
|
||||
|
||||
idl1.resetAddressing(addresses.xfer());
|
||||
idl1.resetAddressing(move(addresses));
|
||||
|
||||
printInfo(idl1);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -80,8 +80,8 @@ int main(int argc, char *argv[])
|
||||
list2.setSize(10, vector(1, 2, 3));
|
||||
Info<< "list2: " << list2 << endl;
|
||||
|
||||
List<vector> list3(list2.xfer());
|
||||
Info<< "Transferred via the xfer() method" << endl;
|
||||
List<vector> list3(move(list2));
|
||||
Info<< "Transferred move" << endl;
|
||||
Info<< "list2: " << list2 << nl
|
||||
<< "list3: " << list3 << endl;
|
||||
|
||||
|
||||
3
applications/test/ListHashTable/Make/files
Normal file
3
applications/test/ListHashTable/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-ListHashTable.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-ListHashTable
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,7 +23,7 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "StaticHashTable.H"
|
||||
#include "ListHashTable.H"
|
||||
#include "IOstreams.H"
|
||||
#include "IStringStream.H"
|
||||
#include "OStringStream.H"
|
||||
@ -31,7 +31,7 @@ License
|
||||
using namespace Foam;
|
||||
|
||||
// use define so we can easily test other implementations
|
||||
#define HASHTABLE_CLASS StaticHashTable
|
||||
#define HASHTABLE_CLASS ListHashTable
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
@ -91,10 +91,10 @@ int main()
|
||||
|
||||
|
||||
HASHTABLE_CLASS<double> table2(table1);
|
||||
HASHTABLE_CLASS<double> table3(table1.xfer());
|
||||
HASHTABLE_CLASS<double> table3(move(table1));
|
||||
|
||||
Info<< "\ncopy table1 -> table2" << nl
|
||||
<< "transfer table1 -> table3 via the xfer() method" << nl;
|
||||
<< "move table1 -> table3" << nl;
|
||||
|
||||
Info<< "\ntable1" << table1 << nl
|
||||
<< "\ntable2" << table2 << nl
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -116,8 +116,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<<"list1: " << list1 << endl;
|
||||
|
||||
PtrList<Scalar> list3(list1.xfer());
|
||||
Info<< "Transferred via the xfer() method" << endl;
|
||||
PtrList<Scalar> list3(move(list1));
|
||||
Info<< "Transferred via move" << endl;
|
||||
|
||||
Info<<"list1: " << list1 << endl;
|
||||
Info<<"list2: " << list2 << endl;
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
Test-staticHashTable.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-staticHashTable
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -70,7 +70,7 @@ int main(int argc, char *argv[])
|
||||
<< "keys: " << dict1.keys() << nl
|
||||
<< "patterns: " << dict1.keys(true) << endl;
|
||||
|
||||
dictionary dict2(dict1.xfer());
|
||||
dictionary dict2(move(dict1));
|
||||
|
||||
Info<< "dict1.toc(): " << dict1.name() << " " << dict1.toc() << nl
|
||||
<< "dict2.toc(): " << dict2.name() << " " << dict2.toc()
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -92,7 +92,7 @@ int main(int argc, char *argv[])
|
||||
runTime,
|
||||
Foam::IOobject::NO_READ
|
||||
),
|
||||
Xfer<pointField>(points),
|
||||
clone(points),
|
||||
shapes,
|
||||
boundaryFaces,
|
||||
boundaryPatchNames,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -126,7 +126,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// Construct distribute map (destructively)
|
||||
mapDistribute map(constructSize, sendMap.xfer(), recvMap.xfer());
|
||||
mapDistribute map(constructSize, move(sendMap), move(recvMap));
|
||||
|
||||
// Distribute complexData
|
||||
map.distribute(complexData);
|
||||
|
||||
@ -247,15 +247,15 @@ int main(int argc, char *argv[])
|
||||
writeFaceFaces(localPoints, localFaces, faceFaces);
|
||||
}
|
||||
|
||||
// Test construction from Xfer
|
||||
// Test move construction
|
||||
{
|
||||
faceList patchFaces = patch;
|
||||
pointField allPoints = patch.points();
|
||||
|
||||
PrimitivePatch<faceList, pointField> storedPatch
|
||||
(
|
||||
patchFaces.xfer(),
|
||||
allPoints.xfer()
|
||||
move(patchFaces),
|
||||
move(allPoints)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
Test-xferList.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-xferList
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -211,9 +211,9 @@ int main(int argc, char *argv[])
|
||||
runTime.timeName(),
|
||||
runTime
|
||||
),
|
||||
xferCopy(mesh.points()), // could we safely re-use the data?
|
||||
xferCopy(mesh.faces()),
|
||||
xferCopy(mesh.cells())
|
||||
clone(mesh.points()), // could we safely re-use the data?
|
||||
clone(mesh.faces()),
|
||||
clone(mesh.cells())
|
||||
);
|
||||
|
||||
// Add the boundary patches
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -948,10 +948,10 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove<pointField>(foamPoints),
|
||||
xferMove<faceList>(foamFaces),
|
||||
xferCopy<labelList>(foamOwner),
|
||||
xferMove<labelList>(foamNeighbour)
|
||||
move(foamPoints),
|
||||
move(foamFaces),
|
||||
clone(foamOwner),
|
||||
move(foamNeighbour)
|
||||
);
|
||||
|
||||
// Create patches. Use patch types to determine what Foam types to generate.
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -448,7 +448,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferCopy(points),
|
||||
clone(points),
|
||||
cellShapes,
|
||||
faceListList(0),
|
||||
wordList(0),
|
||||
@ -595,7 +595,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
move(points),
|
||||
cellShapes,
|
||||
patchFaces,
|
||||
patchNames,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -737,7 +737,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
move(points),
|
||||
cellShapes,
|
||||
boundary,
|
||||
patchNames,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -932,10 +932,10 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferCopy(pointField()),
|
||||
xferCopy(faceList()),
|
||||
xferCopy(labelList()),
|
||||
xferCopy(labelList())
|
||||
pointField(),
|
||||
faceList(),
|
||||
labelList(),
|
||||
labelList()
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -1167,7 +1167,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
move(points),
|
||||
cellShapes,
|
||||
patches,
|
||||
patchNames,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -843,7 +843,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
move(points),
|
||||
cells,
|
||||
boundary,
|
||||
patchNames,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -916,7 +916,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
move(points),
|
||||
cells,
|
||||
boundaryFaces,
|
||||
boundaryPatchNames,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -1129,15 +1129,15 @@ int main(int argc, char *argv[])
|
||||
// Create globally numbered surface
|
||||
meshedSurface rawSurface
|
||||
(
|
||||
xferCopy(polyPoints),
|
||||
xferCopyTo<faceList>(boundaryFaces)
|
||||
clone(polyPoints),
|
||||
clone(boundaryFaces)
|
||||
);
|
||||
|
||||
// Write locally numbered surface
|
||||
meshedSurface
|
||||
(
|
||||
xferCopy(rawSurface.localPoints()),
|
||||
xferCopy(rawSurface.localFaces())
|
||||
clone(rawSurface.localPoints()),
|
||||
clone(rawSurface.localFaces())
|
||||
).write(runTime.path()/"boundaryFaces.obj");
|
||||
}
|
||||
|
||||
@ -1172,7 +1172,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(polyPoints),
|
||||
move(polyPoints),
|
||||
cellVerts,
|
||||
usedPatchFaceVerts, // boundaryFaces,
|
||||
usedPatchNames, // boundaryPatchNames,
|
||||
|
||||
@ -565,7 +565,7 @@ polyMesh pShapeMesh
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
move(points),
|
||||
cellShapes,
|
||||
boundary,
|
||||
patchNames,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -141,7 +141,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
move(points),
|
||||
cells,
|
||||
faceListList(0),
|
||||
wordList(0),
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -300,7 +300,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
move(points),
|
||||
cells,
|
||||
patchFaces,
|
||||
patchNames,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -245,7 +245,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(newPoints),
|
||||
move(newPoints),
|
||||
cellShapes,
|
||||
boundary,
|
||||
patchNames,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -46,7 +46,7 @@ void Foam::sammMesh::writeMesh()
|
||||
runTime_.constant(),
|
||||
runTime_
|
||||
),
|
||||
xferCopy(points_), // we could probably re-use the data
|
||||
clone(points_), // we could probably re-use the data
|
||||
cellShapes_,
|
||||
boundary_,
|
||||
patchNames_,
|
||||
@ -75,9 +75,9 @@ void Foam::sammMesh::writeMesh()
|
||||
runTime_.constant(),
|
||||
runTime_
|
||||
),
|
||||
xferCopy(points_), // we could probably re-use the data
|
||||
xferCopy(meshFaces_),
|
||||
xferCopy(cellPolys_)
|
||||
move(points_), // we could probably re-use the data
|
||||
move(meshFaces_),
|
||||
move(cellPolys_)
|
||||
);
|
||||
|
||||
pMesh.addPatches(polyBoundaryPatches(pMesh));
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -50,7 +50,7 @@ void Foam::starMesh::writeMesh()
|
||||
runTime_.constant(),
|
||||
runTime_
|
||||
),
|
||||
xferCopy(points_), // we could probably re-use the data
|
||||
clone(points_), // we could probably re-use the data
|
||||
cellShapes_,
|
||||
boundary_,
|
||||
patchNames_,
|
||||
@ -81,9 +81,9 @@ void Foam::starMesh::writeMesh()
|
||||
runTime_.constant(),
|
||||
runTime_
|
||||
),
|
||||
xferCopy(points_), // we could probably re-use the data
|
||||
xferCopy(meshFaces_),
|
||||
xferCopy(cellPolys_)
|
||||
clone(points_), // we could probably re-use the data
|
||||
clone(meshFaces_),
|
||||
clone(cellPolys_)
|
||||
);
|
||||
|
||||
// adding patches also checks the mesh
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -326,7 +326,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferCopy(points),
|
||||
clone(points),
|
||||
cells,
|
||||
faceListList(0),
|
||||
wordList(0), // boundaryPatchNames
|
||||
@ -530,7 +530,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
move(points),
|
||||
cells,
|
||||
patchFaces,
|
||||
patchNames,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -62,7 +62,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(reader.points()),
|
||||
move(reader.points()),
|
||||
reader.cells(),
|
||||
faceListList(0),
|
||||
wordList(0),
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -267,7 +267,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferCopy(blocks.points()), // could we re-use space?
|
||||
clone(blocks.points()), // could we re-use space?
|
||||
blocks.cells(),
|
||||
blocks.patches(),
|
||||
blocks.patchNames(),
|
||||
|
||||
@ -63,7 +63,7 @@ class extrudedMesh
|
||||
|
||||
//- Construct and return the extruded mesh points
|
||||
template<class FaceList, class PointField>
|
||||
Xfer<pointField> extrudedPoints
|
||||
pointField extrudedPoints
|
||||
(
|
||||
const PrimitivePatch<FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel&
|
||||
@ -71,7 +71,7 @@ class extrudedMesh
|
||||
|
||||
//- Construct and return the extruded mesh faces
|
||||
template<class FaceList, class PointField>
|
||||
Xfer<faceList> extrudedFaces
|
||||
faceList extrudedFaces
|
||||
(
|
||||
const PrimitivePatch<FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel&
|
||||
@ -79,7 +79,7 @@ class extrudedMesh
|
||||
|
||||
//- Construct and return the extruded mesh cells
|
||||
template<class FaceList, class PointField>
|
||||
Xfer<cellList> extrudedCells
|
||||
cellList extrudedCells
|
||||
(
|
||||
const PrimitivePatch<FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel&
|
||||
|
||||
@ -29,7 +29,7 @@ License
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class FaceList, class PointField>
|
||||
Foam::Xfer<Foam::pointField> Foam::extrudedMesh::extrudedPoints
|
||||
Foam::pointField Foam::extrudedMesh::extrudedPoints
|
||||
(
|
||||
const PrimitivePatch<FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel& model
|
||||
@ -57,13 +57,12 @@ Foam::Xfer<Foam::pointField> Foam::extrudedMesh::extrudedPoints
|
||||
}
|
||||
}
|
||||
|
||||
// return points for transferring
|
||||
return xferMove(ePoints);
|
||||
return ePoints;
|
||||
}
|
||||
|
||||
|
||||
template<class FaceList, class PointField>
|
||||
Foam::Xfer<Foam::faceList> Foam::extrudedMesh::extrudedFaces
|
||||
Foam::faceList Foam::extrudedMesh::extrudedFaces
|
||||
(
|
||||
const PrimitivePatch<FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel& model
|
||||
@ -183,13 +182,12 @@ Foam::Xfer<Foam::faceList> Foam::extrudedMesh::extrudedFaces
|
||||
);
|
||||
}
|
||||
|
||||
// return points for transferring
|
||||
return xferMove(eFaces);
|
||||
return eFaces;
|
||||
}
|
||||
|
||||
|
||||
template<class FaceList, class PointField>
|
||||
Foam::Xfer<Foam::cellList> Foam::extrudedMesh::extrudedCells
|
||||
Foam::cellList Foam::extrudedMesh::extrudedCells
|
||||
(
|
||||
const PrimitivePatch<FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel& model
|
||||
@ -290,8 +288,7 @@ Foam::Xfer<Foam::cellList> Foam::extrudedMesh::extrudedCells
|
||||
facei++;
|
||||
}
|
||||
|
||||
// return points for transferring
|
||||
return xferMove(eCells);
|
||||
return eCells;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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>());
|
||||
@ -2349,10 +2349,10 @@ int main(int argc, char *argv[])
|
||||
IOobject::AUTO_WRITE,
|
||||
false
|
||||
),
|
||||
xferCopy(pointField()),
|
||||
xferCopy(faceList()),
|
||||
xferCopy(labelList()),
|
||||
xferCopy(labelList()),
|
||||
pointField(),
|
||||
faceList(),
|
||||
labelList(),
|
||||
labelList(),
|
||||
false
|
||||
);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -199,10 +199,10 @@ int main(int argc, char *argv[])
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
xferMove(poly2DMesh.points()),
|
||||
xferMove(poly2DMesh.faces()),
|
||||
xferMove(poly2DMesh.owner()),
|
||||
xferMove(poly2DMesh.neighbour())
|
||||
move(poly2DMesh.points()),
|
||||
move(poly2DMesh.faces()),
|
||||
move(poly2DMesh.owner()),
|
||||
move(poly2DMesh.neighbour())
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -247,7 +247,7 @@ void Foam::patchToPoly2DMesh::addPatchFacesToOwner()
|
||||
<< nExternalEdges << endl;
|
||||
}
|
||||
|
||||
owner_ = newOwner.xfer();
|
||||
owner_ = move(newOwner);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -605,10 +605,10 @@ Foam::DelaunayMesh<Triangulation>::createMesh
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
xferMove(points),
|
||||
xferMove(faces),
|
||||
xferMove(owner),
|
||||
xferMove(neighbour)
|
||||
move(points),
|
||||
move(faces),
|
||||
move(owner),
|
||||
move(neighbour)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -113,8 +113,8 @@ Foam::DistributedDelaunayMesh<Triangulation>::buildMap
|
||||
new mapDistribute
|
||||
(
|
||||
constructSize,
|
||||
sendMap.xfer(),
|
||||
constructMap.xfer()
|
||||
move(sendMap),
|
||||
move(constructMap)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -214,7 +214,7 @@ Foam::labelList Foam::DistributedDelaunayMesh<Triangulation>::overlapProcessors
|
||||
}
|
||||
}
|
||||
|
||||
return toProc;
|
||||
return move(toProc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,9 +35,7 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(backgroundMeshDecomposition, 0);
|
||||
|
||||
defineTypeNameAndDebug(backgroundMeshDecomposition, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -118,8 +116,8 @@ Foam::autoPtr<Foam::mapDistribute> Foam::backgroundMeshDecomposition::buildMap
|
||||
new mapDistribute
|
||||
(
|
||||
constructSize,
|
||||
sendMap.xfer(),
|
||||
constructMap.xfer()
|
||||
move(sendMap),
|
||||
move(constructMap)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -1370,7 +1368,7 @@ Foam::labelList Foam::backgroundMeshDecomposition::overlapProcessors
|
||||
}
|
||||
}
|
||||
|
||||
return toProc;
|
||||
return Foam::move(toProc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -739,10 +739,10 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
xferCopy(pts),
|
||||
xferMove(faces),
|
||||
xferMove(owner),
|
||||
xferMove(neighbour)
|
||||
clone(pts),
|
||||
Foam::move(faces),
|
||||
Foam::move(owner),
|
||||
Foam::move(neighbour)
|
||||
)
|
||||
);
|
||||
|
||||
@ -991,7 +991,7 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::findOffsetPatchFaces
|
||||
offsetBoundaryCells.write();
|
||||
}
|
||||
|
||||
return offsetBoundaryCells;
|
||||
return Foam::move(offsetBoundaryCells);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -1839,7 +1839,7 @@ Foam::conformalVoronoiMesh::nearestFeatureEdgeLocations
|
||||
dynPointHit.append(nearHit);
|
||||
}
|
||||
|
||||
return dynPointHit;
|
||||
return Foam::move(dynPointHit);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -444,7 +444,7 @@ inline Foam::List<bool> Foam::conformalVoronoiMesh::dualFaceBoundaryPoints
|
||||
|
||||
} while (cc1 != ccStart);
|
||||
|
||||
return tmpFaceBoundaryPoints;
|
||||
return Foam::move(tmpFaceBoundaryPoints);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -410,9 +410,9 @@ Foam::autoPtr<Foam::fvMesh> Foam::conformalVoronoiMesh::createDummyMesh
|
||||
new fvMesh
|
||||
(
|
||||
io,
|
||||
xferCopy(pointField()),
|
||||
xferCopy(faceList()),
|
||||
xferCopy(cellList())
|
||||
pointField(),
|
||||
faceList(),
|
||||
cellList()
|
||||
)
|
||||
);
|
||||
fvMesh& mesh = meshPtr();
|
||||
@ -817,10 +817,10 @@ void Foam::conformalVoronoiMesh::writeMesh
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
xferMove(points),
|
||||
xferMove(faces),
|
||||
xferMove(owner),
|
||||
xferMove(neighbour)
|
||||
Foam::move(points),
|
||||
Foam::move(faces),
|
||||
Foam::move(owner),
|
||||
Foam::move(neighbour)
|
||||
);
|
||||
|
||||
Info<< indent << "Adding patches to mesh" << endl;
|
||||
@ -1399,7 +1399,7 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::findRemainingProtrusionSet
|
||||
protrudingCells.write();
|
||||
}
|
||||
|
||||
return protrudingCells;
|
||||
return Foam::move(protrudingCells);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -961,7 +961,7 @@ List<Vb::Point> autoDensity::initialPoints() const
|
||||
<< decrIndent << decrIndent
|
||||
<< endl;
|
||||
|
||||
return initialPoints;
|
||||
return move(initialPoints);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -194,7 +194,7 @@ List<Vb::Point> pointFile::initialPoints() const
|
||||
<< pointFileName_.name() << endl;
|
||||
}
|
||||
|
||||
return initialPoints;
|
||||
return Foam::move(initialPoints);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -287,7 +287,7 @@ autoPtr<polyMesh> generateHexMesh
|
||||
new polyMesh
|
||||
(
|
||||
io,
|
||||
xferMoveTo<pointField>(points),
|
||||
move(points),
|
||||
cellShapes,
|
||||
boundary,
|
||||
patchNames,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -155,10 +155,10 @@ int main(int argc, char *argv[])
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
xferMove(poly2DMesh.points()),
|
||||
xferMove(poly2DMesh.faces()),
|
||||
xferMove(poly2DMesh.owner()),
|
||||
xferMove(poly2DMesh.neighbour())
|
||||
move(poly2DMesh.points()),
|
||||
move(poly2DMesh.faces()),
|
||||
move(poly2DMesh.owner()),
|
||||
move(poly2DMesh.neighbour())
|
||||
);
|
||||
|
||||
Info<< "Constructing patches." << endl;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -204,7 +204,7 @@ Foam::shortEdgeFilter2D::shortEdgeFilter2D
|
||||
|
||||
points2D.clear();
|
||||
|
||||
ms_ = MeshedSurface<face>(xferMove(points), xferMove(faces));
|
||||
ms_ = MeshedSurface<face>(move(points), move(faces));
|
||||
|
||||
Info<< "Meshed surface stats before edge filtering :" << endl;
|
||||
ms_.writeStats(Info);
|
||||
@ -535,9 +535,9 @@ Foam::shortEdgeFilter2D::filter()
|
||||
|
||||
MeshedSurface<face> fMesh
|
||||
(
|
||||
xferMove(newPoints),
|
||||
xferMove(newFaces),
|
||||
xferCopy(List<surfZone>())
|
||||
move(newPoints),
|
||||
move(newFaces),
|
||||
List<surfZone>()
|
||||
);
|
||||
|
||||
updateEdgeRegionMap
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -471,7 +471,7 @@ void extractSurface
|
||||
|
||||
// Gather all ZoneIDs
|
||||
List<labelList> gatheredZones(Pstream::nProcs());
|
||||
gatheredZones[Pstream::myProcNo()] = compactZones.xfer();
|
||||
gatheredZones[Pstream::myProcNo()] = move(compactZones);
|
||||
Pstream::gatherList(gatheredZones);
|
||||
|
||||
// On master combine all points, faces, zones
|
||||
@ -510,10 +510,10 @@ void extractSurface
|
||||
|
||||
UnsortedMeshedSurface<face> unsortedFace
|
||||
(
|
||||
xferMove(allPoints),
|
||||
xferMove(allFaces),
|
||||
xferMove(allZones),
|
||||
xferMove(surfZones)
|
||||
move(allPoints),
|
||||
move(allFaces),
|
||||
move(allZones),
|
||||
move(surfZones)
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -392,9 +392,9 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io, const word& dictName)
|
||||
new fvMesh
|
||||
(
|
||||
io,
|
||||
xferMove(newPoints),
|
||||
xferMove(newFaces),
|
||||
xferMove(newCells)
|
||||
move(newPoints),
|
||||
move(newFaces),
|
||||
move(newCells)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -448,10 +448,10 @@ autoPtr<mapPolyMesh> reorderMesh
|
||||
|
||||
mesh.resetPrimitives
|
||||
(
|
||||
Xfer<pointField>::null(),
|
||||
xferMove(newFaces),
|
||||
xferMove(newOwner),
|
||||
xferMove(newNeighbour),
|
||||
NullObjectMove<pointField>(),
|
||||
move(newFaces),
|
||||
move(newOwner),
|
||||
move(newNeighbour),
|
||||
patchSizes,
|
||||
patchStarts,
|
||||
true
|
||||
|
||||
@ -357,9 +357,9 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
|
||||
facesInstance(),
|
||||
processorDb
|
||||
),
|
||||
xferMove(facesInstancePoints),
|
||||
xferMove(procFaces),
|
||||
xferMove(procCells)
|
||||
move(facesInstancePoints),
|
||||
move(procFaces),
|
||||
move(procCells)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -375,9 +375,9 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
|
||||
facesInstance(),
|
||||
processorDb
|
||||
),
|
||||
xferMove(procPoints),
|
||||
xferMove(procFaces),
|
||||
xferMove(procCells)
|
||||
move(procPoints),
|
||||
move(procFaces),
|
||||
move(procCells)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -758,7 +758,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
xferMove(procPoints)
|
||||
move(procPoints)
|
||||
);
|
||||
pointsInstancePoints.write();
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -673,9 +673,9 @@ int main(int argc, char *argv[])
|
||||
runTime,
|
||||
IOobject::NO_READ
|
||||
),
|
||||
xferCopy(pointField()),
|
||||
xferCopy(faceList()),
|
||||
xferCopy(cellList())
|
||||
pointField(),
|
||||
faceList(),
|
||||
cellList()
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -132,10 +132,10 @@ Foam::autoPtr<Foam::fvMesh> Foam::loadOrCreateMesh
|
||||
fvMesh dummyMesh
|
||||
(
|
||||
noReadIO,
|
||||
xferCopy(pointField()),
|
||||
xferCopy(faceList()),
|
||||
xferCopy(labelList()),
|
||||
xferCopy(labelList()),
|
||||
pointField(),
|
||||
faceList(),
|
||||
labelList(),
|
||||
labelList(),
|
||||
false
|
||||
);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -49,7 +49,7 @@ Foam::tmp<Foam::Field<Type>> Foam::readParticleField
|
||||
if (obj != nullptr)
|
||||
{
|
||||
IOField<Type> newField(*obj);
|
||||
return tmp<Field<Type>>(new Field<Type>(newField.xfer()));
|
||||
return tmp<Field<Type>>(new Field<Type>(move(newField)));
|
||||
}
|
||||
|
||||
FatalErrorInFunction
|
||||
@ -77,7 +77,7 @@ void Foam::readFields
|
||||
{
|
||||
Info<< " reading field " << fieldNames[j] << endl;
|
||||
IOField<Type> newField(*obj);
|
||||
values.set(j, new List<Type>(newField.xfer()));
|
||||
values.set(j, new List<Type>(move(newField)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -334,7 +334,7 @@ int main(int argc, char *argv[])
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
surf.xfer()
|
||||
move(surf)
|
||||
);
|
||||
|
||||
Info<< "writing surfMesh as well: " << surfOut.objectPath() << endl;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -284,7 +284,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
surf.xfer()
|
||||
move(surf)
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -308,7 +308,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Gather all ZoneIDs
|
||||
List<labelList> gatheredZones(Pstream::nProcs());
|
||||
gatheredZones[Pstream::myProcNo()] = compactZones.xfer();
|
||||
gatheredZones[Pstream::myProcNo()] = move(compactZones);
|
||||
Pstream::gatherList(gatheredZones);
|
||||
|
||||
// On master combine all points, faces, zones
|
||||
@ -347,10 +347,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
UnsortedMeshedSurface<face> unsortedFace
|
||||
(
|
||||
xferMove(allPoints),
|
||||
xferMove(allFaces),
|
||||
xferMove(allZones),
|
||||
xferMove(surfZones)
|
||||
move(allPoints),
|
||||
move(allFaces),
|
||||
move(allZones),
|
||||
move(surfZones)
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -1357,7 +1357,8 @@ Foam::fileNameList Foam::dlLoaded()
|
||||
<< "dlLoaded()"
|
||||
<< " : determined loaded libraries :" << libs.size() << std::endl;
|
||||
}
|
||||
return libs;
|
||||
|
||||
return move(libs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -142,7 +142,7 @@ primitives/Barycentric/barycentric/barycentric.C
|
||||
primitives/Barycentric2D/barycentric2D/barycentric2D.C
|
||||
|
||||
containers/HashTables/HashTable/HashTableCore.C
|
||||
containers/HashTables/StaticHashTable/StaticHashTableCore.C
|
||||
containers/HashTables/ListHashTable/ListHashTableCore.C
|
||||
containers/Lists/SortableList/ParSortableListName.C
|
||||
containers/Lists/PackedList/PackedListCore.C
|
||||
containers/Lists/PackedList/PackedBoolList.C
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -104,12 +104,12 @@ Foam::treeDataCell::treeDataCell
|
||||
(
|
||||
const bool cacheBb,
|
||||
const polyMesh& mesh,
|
||||
const Xfer<labelList>& cellLabels,
|
||||
labelList&& cellLabels,
|
||||
const polyMesh::cellDecomposition decompMode
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
cellLabels_(cellLabels),
|
||||
cellLabels_(move(cellLabels)),
|
||||
cacheBb_(cacheBb),
|
||||
decompMode_(decompMode)
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -146,12 +146,12 @@ public:
|
||||
const polyMesh::cellDecomposition decompMode
|
||||
);
|
||||
|
||||
//- Construct from mesh and subset of cells, transferring contents
|
||||
//- Move construct from mesh and subset of cells, transferring contents
|
||||
treeDataCell
|
||||
(
|
||||
const bool cacheBb,
|
||||
const polyMesh&,
|
||||
const Xfer<labelList>&,
|
||||
labelList&&,
|
||||
const polyMesh::cellDecomposition decompMode
|
||||
);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -64,9 +64,12 @@ public:
|
||||
//- Construct given initial table size
|
||||
Dictionary(const label size = 128);
|
||||
|
||||
//- Copy construct
|
||||
//- Copy constructor
|
||||
Dictionary(const Dictionary&);
|
||||
|
||||
//- Move constructor
|
||||
Dictionary(Dictionary&&);
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 INew>
|
||||
Foam::DictionaryBase<IDLListType, T>::DictionaryBase
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -95,9 +95,12 @@ public:
|
||||
//- Construct given initial table size
|
||||
DictionaryBase(const label size = 128);
|
||||
|
||||
//- Copy construct
|
||||
//- Copy constructor
|
||||
DictionaryBase(const DictionaryBase&);
|
||||
|
||||
//- Move constructor
|
||||
DictionaryBase(DictionaryBase&&);
|
||||
|
||||
//- Construct from Istream using given Istream constructor class
|
||||
template<class INew>
|
||||
DictionaryBase(Istream&, const INew&);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 INew>
|
||||
Foam::PtrDictionary<T>::PtrDictionary(Istream& is, const INew& iNew)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -63,9 +63,12 @@ public:
|
||||
//- Construct given initial table size
|
||||
PtrDictionary(const label size = 128);
|
||||
|
||||
//- Copy construct
|
||||
//- Copy constructor
|
||||
PtrDictionary(const PtrDictionary&);
|
||||
|
||||
//- Move constructor
|
||||
PtrDictionary(PtrDictionary&&);
|
||||
|
||||
//- Construct from Istream using given Istream constructor class
|
||||
template<class INew>
|
||||
PtrDictionary(Istream&, const INew&);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 INew>
|
||||
Foam::PtrListDictionary<T>::PtrListDictionary(Istream& is, const INew& iNew)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -63,9 +63,12 @@ public:
|
||||
//- Construct given initial list size
|
||||
PtrListDictionary(const label size);
|
||||
|
||||
//- Copy construct
|
||||
//- Copy constructor
|
||||
PtrListDictionary(const PtrListDictionary&);
|
||||
|
||||
//- Move constructor
|
||||
PtrListDictionary(PtrListDictionary&&);
|
||||
|
||||
//- Construct from Istream using given Istream constructor class
|
||||
template<class INew>
|
||||
PtrListDictionary(Istream&, const INew&);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 * * * * * * * * * * * * * * * //
|
||||
|
||||
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 * * * * * * * * * * * * * //
|
||||
|
||||
#include "HashPtrTableIO.C"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -103,6 +103,9 @@ public:
|
||||
//- Construct as copy
|
||||
HashPtrTable(const HashPtrTable<T, Key, Hash>&);
|
||||
|
||||
//- Move constructor
|
||||
HashPtrTable(HashPtrTable<T, Key, Hash>&&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~HashPtrTable();
|
||||
@ -127,8 +130,12 @@ public:
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Assignment operator
|
||||
void operator=(const HashPtrTable<T, Key, Hash>&);
|
||||
|
||||
//- Move assignment operator
|
||||
void operator=(HashPtrTable<T, Key, Hash>&&);
|
||||
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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>
|
||||
bool Foam::HashSet<Key, Hash>::operator==(const HashSet<Key, Hash>& rhs) const
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -90,22 +90,10 @@ public:
|
||||
HashSet(const FixedList<Key, Size>&);
|
||||
|
||||
//- Construct as copy
|
||||
HashSet(const HashSet<Key, Hash>& hs)
|
||||
:
|
||||
HashTable<nil, Key, Hash>(hs)
|
||||
{}
|
||||
HashSet(const HashSet<Key, Hash>& hs) = default;
|
||||
|
||||
//- Construct by transferring the parameter contents
|
||||
HashSet(const Xfer<HashSet<Key, Hash>>& hs)
|
||||
:
|
||||
HashTable<nil, Key, Hash>(hs)
|
||||
{}
|
||||
|
||||
//- Construct by transferring the parameter contents
|
||||
HashSet(const Xfer<HashTable<nil, Key, Hash>>& hs)
|
||||
:
|
||||
HashTable<nil, Key, Hash>(hs)
|
||||
{}
|
||||
//- Move constructor
|
||||
HashSet(HashSet<Key, Hash>&& hs) = default;
|
||||
|
||||
//- Construct from the keys of another HashTable,
|
||||
// the type of values held is arbitrary.
|
||||
@ -151,6 +139,12 @@ public:
|
||||
//- Return true if the entry exists, same as found()
|
||||
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.
|
||||
// Independent of table size or order.
|
||||
bool operator==(const HashSet<Key, Hash>&) const;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -67,7 +67,7 @@ Foam::HashTable<T, Key, Hash>::HashTable(const HashTable<T, Key, Hash>& ht)
|
||||
template<class T, class Key, class Hash>
|
||||
Foam::HashTable<T, Key, Hash>::HashTable
|
||||
(
|
||||
const Xfer<HashTable<T, Key, Hash>>& ht
|
||||
HashTable<T, Key, Hash>&& ht
|
||||
)
|
||||
:
|
||||
HashTableCore(),
|
||||
@ -75,7 +75,7 @@ Foam::HashTable<T, Key, Hash>::HashTable
|
||||
tableSize_(0),
|
||||
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>
|
||||
void Foam::HashTable<T, Key, Hash>::operator=
|
||||
(
|
||||
|
||||
@ -47,7 +47,6 @@ SourceFiles
|
||||
#include "label.H"
|
||||
#include "uLabel.H"
|
||||
#include "word.H"
|
||||
#include "Xfer.H"
|
||||
#include "className.H"
|
||||
#include <initializer_list>
|
||||
|
||||
@ -212,8 +211,8 @@ public:
|
||||
//- Construct as copy
|
||||
HashTable(const HashTable<T, Key, Hash>&);
|
||||
|
||||
//- Construct by transferring the parameter contents
|
||||
HashTable(const Xfer<HashTable<T, Key, Hash>>&);
|
||||
//- More Constructor
|
||||
HashTable(HashTable<T, Key, Hash>&&);
|
||||
|
||||
//- Construct from an initializer list
|
||||
HashTable(std::initializer_list<Tuple2<Key, T>>);
|
||||
@ -300,9 +299,6 @@ public:
|
||||
// and annul the argument table.
|
||||
void transfer(HashTable<T, Key, Hash>&);
|
||||
|
||||
//- Transfer contents to the Xfer container
|
||||
inline Xfer<HashTable<T, Key, Hash>> xfer();
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
@ -315,9 +311,12 @@ public:
|
||||
//- Find and return a hashedEntry, create it null if not present
|
||||
inline T& operator()(const Key&);
|
||||
|
||||
//- Assignment
|
||||
//- Assignment operator
|
||||
void operator=(const HashTable<T, Key, Hash>&);
|
||||
|
||||
//- Move assignment operator
|
||||
void operator=(HashTable<T, Key, Hash>&&);
|
||||
|
||||
//- Assignment to an initializer list
|
||||
void operator=(std::initializer_list<Tuple2<Key, T>>);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,16 +23,16 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef StaticHashTable_C
|
||||
#define StaticHashTable_C
|
||||
#ifndef ListHashTable_C
|
||||
#define ListHashTable_C
|
||||
|
||||
#include "StaticHashTable.H"
|
||||
#include "ListHashTable.H"
|
||||
#include "List.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::StaticHashTableCore::canonicalSize(const label size)
|
||||
Foam::label Foam::ListHashTableCore::canonicalSize(const label size)
|
||||
{
|
||||
if (size < 1)
|
||||
{
|
||||
@ -59,10 +59,10 @@ Foam::label Foam::StaticHashTableCore::canonicalSize(const label size)
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
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(),
|
||||
keys_(StaticHashTableCore::canonicalSize(size)),
|
||||
ListHashTableCore(),
|
||||
keys_(ListHashTableCore::canonicalSize(size)),
|
||||
objects_(keys_.size()),
|
||||
nElmts_(0),
|
||||
endIter_(*this, keys_.size(), 0),
|
||||
@ -71,19 +71,19 @@ Foam::StaticHashTable<T, Key, Hash>::StaticHashTable(const label size)
|
||||
if (size < 1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Illegal size " << size << " for StaticHashTable."
|
||||
<< "Illegal size " << size << " for ListHashTable."
|
||||
<< " Minimum size is 1" << abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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_),
|
||||
objects_(ht.objects_),
|
||||
nElmts_(ht.nElmts_),
|
||||
@ -93,33 +93,33 @@ Foam::StaticHashTable<T, Key, Hash>::StaticHashTable
|
||||
|
||||
|
||||
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),
|
||||
objects_(0),
|
||||
nElmts_(0),
|
||||
endIter_(*this, 0, 0),
|
||||
endConstIter_(*this, 0, 0)
|
||||
{
|
||||
transfer(ht());
|
||||
transfer(ht);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
Foam::StaticHashTable<T, Key, Hash>::~StaticHashTable()
|
||||
Foam::ListHashTable<T, Key, Hash>::~ListHashTable()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
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_)
|
||||
{
|
||||
@ -147,8 +147,8 @@ bool Foam::StaticHashTable<T, Key, Hash>::found(const Key& key) const
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
typename Foam::StaticHashTable<T, Key, Hash>::iterator
|
||||
Foam::StaticHashTable<T, Key, Hash>::find
|
||||
typename Foam::ListHashTable<T, Key, Hash>::iterator
|
||||
Foam::ListHashTable<T, Key, Hash>::find
|
||||
(
|
||||
const Key& key
|
||||
)
|
||||
@ -179,8 +179,8 @@ Foam::StaticHashTable<T, Key, Hash>::find
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
typename Foam::StaticHashTable<T, Key, Hash>::const_iterator
|
||||
Foam::StaticHashTable<T, Key, Hash>::find
|
||||
typename Foam::ListHashTable<T, Key, Hash>::const_iterator
|
||||
Foam::ListHashTable<T, Key, Hash>::find
|
||||
(
|
||||
const Key& key
|
||||
) const
|
||||
@ -211,7 +211,7 @@ Foam::StaticHashTable<T, Key, Hash>::find
|
||||
|
||||
|
||||
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_);
|
||||
label keyI = 0;
|
||||
@ -226,7 +226,7 @@ Foam::List<Key> Foam::StaticHashTable<T, Key, Hash>::toc() const
|
||||
|
||||
|
||||
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 T& newEntry,
|
||||
@ -284,7 +284,7 @@ bool Foam::StaticHashTable<T, Key, Hash>::set
|
||||
|
||||
|
||||
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())
|
||||
{
|
||||
@ -339,7 +339,7 @@ bool Foam::StaticHashTable<T, Key, Hash>::erase(const iterator& cit)
|
||||
|
||||
|
||||
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);
|
||||
|
||||
@ -355,9 +355,9 @@ bool Foam::StaticHashTable<T, Key, Hash>::erase(const Key& key)
|
||||
|
||||
|
||||
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;
|
||||
@ -377,9 +377,9 @@ Foam::label Foam::StaticHashTable<T, Key, Hash>::erase
|
||||
|
||||
|
||||
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())
|
||||
{
|
||||
@ -396,12 +396,12 @@ void Foam::StaticHashTable<T, Key, Hash>::resize(const label sz)
|
||||
if (newSize < 1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Illegal size " << newSize << " for StaticHashTable."
|
||||
<< "Illegal size " << newSize << " for ListHashTable."
|
||||
<< " 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)
|
||||
{
|
||||
@ -417,7 +417,7 @@ void Foam::StaticHashTable<T, Key, Hash>::resize(const label sz)
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
void Foam::StaticHashTable<T, Key, Hash>::clear()
|
||||
void Foam::ListHashTable<T, Key, Hash>::clear()
|
||||
{
|
||||
forAll(keys_, hashIdx)
|
||||
{
|
||||
@ -430,7 +430,7 @@ void Foam::StaticHashTable<T, Key, Hash>::clear()
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
void Foam::StaticHashTable<T, Key, Hash>::clearStorage()
|
||||
void Foam::ListHashTable<T, Key, Hash>::clearStorage()
|
||||
{
|
||||
clear();
|
||||
resize(1);
|
||||
@ -438,9 +438,9 @@ void Foam::StaticHashTable<T, Key, Hash>::clearStorage()
|
||||
|
||||
|
||||
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
|
||||
@ -465,9 +465,9 @@ void Foam::StaticHashTable<T, Key, Hash>::transfer
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
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
|
||||
@ -502,10 +502,29 @@ void Foam::StaticHashTable<T, Key, Hash>::operator=
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
{
|
||||
// Sizes (number of keys) must match
|
||||
@ -525,9 +544,9 @@ bool Foam::StaticHashTable<T, Key, Hash>::operator==
|
||||
|
||||
|
||||
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
|
||||
{
|
||||
return !(operator==(rhs));
|
||||
@ -536,7 +555,7 @@ bool Foam::StaticHashTable<T, Key, Hash>::operator!=
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
#include "StaticHashTableIO.C"
|
||||
#include "ListHashTableIO.C"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -22,30 +22,28 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::StaticHashTable
|
||||
Foam::ListHashTable
|
||||
|
||||
Description
|
||||
STL conforming hash table.
|
||||
STL conforming hash table using contiguous lists rather than linked lists.
|
||||
|
||||
Note
|
||||
Uses straight lists as underlying type.
|
||||
Is slower to insert than the standard HashTable, but should be more
|
||||
memory efficient and faster to access.
|
||||
|
||||
SourceFiles
|
||||
StaticHashTableI.H
|
||||
StaticHashTable.C
|
||||
StaticHashTableIO.C
|
||||
ListHashTableI.H
|
||||
ListHashTable.C
|
||||
ListHashTableIO.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef StaticHashTable_H
|
||||
#define StaticHashTable_H
|
||||
#ifndef ListHashTable_H
|
||||
#define ListHashTable_H
|
||||
|
||||
#include "label.H"
|
||||
#include "uLabel.H"
|
||||
#include "word.H"
|
||||
#include "Xfer.H"
|
||||
#include "className.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -56,37 +54,37 @@ namespace Foam
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
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>>
|
||||
(
|
||||
Istream&,
|
||||
StaticHashTable<T, Key, Hash>&
|
||||
ListHashTable<T, Key, Hash>&
|
||||
);
|
||||
|
||||
template<class T, class Key, class Hash> Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const StaticHashTable<T, Key, Hash>&
|
||||
const ListHashTable<T, Key, Hash>&
|
||||
);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class StaticHashTableCore Declaration
|
||||
Class ListHashTableCore Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
//- Template-invariant bits for StaticHashTable
|
||||
struct StaticHashTableCore
|
||||
//- Template-invariant bits for ListHashTable
|
||||
struct ListHashTableCore
|
||||
{
|
||||
//- Return a canonical (power-of-two) size
|
||||
static label canonicalSize(const label);
|
||||
|
||||
//- Construct null
|
||||
StaticHashTableCore()
|
||||
ListHashTableCore()
|
||||
{}
|
||||
|
||||
//- Define template name and debug
|
||||
ClassName("StaticHashTable");
|
||||
ClassName("ListHashTable");
|
||||
|
||||
//- A zero-sized end iterator
|
||||
struct iteratorEnd
|
||||
@ -100,13 +98,13 @@ struct StaticHashTableCore
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class StaticHashTable Declaration
|
||||
Class ListHashTable Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class T, class Key=word, class Hash=string::hash>
|
||||
class StaticHashTable
|
||||
class ListHashTable
|
||||
:
|
||||
public StaticHashTableCore
|
||||
public ListHashTableCore
|
||||
{
|
||||
// Private data type for table entries
|
||||
|
||||
@ -141,13 +139,13 @@ public:
|
||||
typedef Iterator
|
||||
<
|
||||
T&,
|
||||
StaticHashTable<T, Key, Hash>&
|
||||
ListHashTable<T, Key, Hash>&
|
||||
> iterator;
|
||||
|
||||
typedef Iterator
|
||||
<
|
||||
const T&,
|
||||
const StaticHashTable<T, Key, Hash>&
|
||||
const ListHashTable<T, Key, Hash>&
|
||||
> const_iterator;
|
||||
|
||||
|
||||
@ -156,33 +154,33 @@ public:
|
||||
friend class Iterator
|
||||
<
|
||||
T&,
|
||||
StaticHashTable<T, Key, Hash>&
|
||||
ListHashTable<T, Key, Hash>&
|
||||
>;
|
||||
|
||||
friend class Iterator
|
||||
<
|
||||
const T&,
|
||||
const StaticHashTable<T, Key, Hash>&
|
||||
const ListHashTable<T, Key, Hash>&
|
||||
>;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given initial table size
|
||||
StaticHashTable(const label size = 128);
|
||||
ListHashTable(const label size = 128);
|
||||
|
||||
//- Construct from Istream
|
||||
StaticHashTable(Istream&, const label size = 128);
|
||||
ListHashTable(Istream&, const label size = 128);
|
||||
|
||||
//- Construct as copy
|
||||
StaticHashTable(const StaticHashTable<T, Key, Hash>&);
|
||||
ListHashTable(const ListHashTable<T, Key, Hash>&);
|
||||
|
||||
//- Construct by transferring the parameter contents
|
||||
StaticHashTable(const Xfer<StaticHashTable<T, Key, Hash>>&);
|
||||
//- Move constructor
|
||||
ListHashTable(ListHashTable<T, Key, Hash>&&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~StaticHashTable();
|
||||
~ListHashTable();
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -232,7 +230,7 @@ public:
|
||||
|
||||
//- Remove entries in the given hash table from this hash table
|
||||
// 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
|
||||
void clear();
|
||||
@ -243,10 +241,7 @@ public:
|
||||
|
||||
//- Transfer the contents of the argument table into this table
|
||||
// and annul the argument table.
|
||||
void transfer(StaticHashTable<T, Key, Hash>&);
|
||||
|
||||
//- Transfer contents to the Xfer container
|
||||
inline Xfer<StaticHashTable<T, Key, Hash>> xfer();
|
||||
void transfer(ListHashTable<T, Key, Hash>&);
|
||||
|
||||
|
||||
// Member Operators
|
||||
@ -260,32 +255,35 @@ public:
|
||||
//- Find and return an hashed entry, create it null if not present.
|
||||
inline T& operator()(const Key&);
|
||||
|
||||
//- Assignment
|
||||
void operator=(const StaticHashTable<T, Key, Hash>&);
|
||||
//- Assignment operator
|
||||
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
|
||||
// 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.
|
||||
bool operator!=(const StaticHashTable<T, Key, Hash>&) const;
|
||||
bool operator!=(const ListHashTable<T, Key, Hash>&) const;
|
||||
|
||||
|
||||
// STL type definitions
|
||||
|
||||
//- Type of values the StaticHashTable contains.
|
||||
//- Type of values the ListHashTable contains.
|
||||
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&.
|
||||
typedef T& reference;
|
||||
|
||||
//- Type that can be used for storing into constant
|
||||
// StaticHashTable::value_type objects. This type is usually const
|
||||
// StaticHashTable::value_type&.
|
||||
// ListHashTable::value_type objects. This type is usually const
|
||||
// ListHashTable::value_type&.
|
||||
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;
|
||||
|
||||
|
||||
@ -295,14 +293,14 @@ public:
|
||||
template<class TRef, class TableRef>
|
||||
class Iterator
|
||||
{
|
||||
friend class StaticHashTable;
|
||||
friend class ListHashTable;
|
||||
|
||||
template<class TRef2, class TableRef2>
|
||||
friend class Iterator;
|
||||
|
||||
// Private data
|
||||
|
||||
//- Reference to the StaticHashTable this is an iterator for
|
||||
//- Reference to the ListHashTable this is an iterator for
|
||||
TableRef hashTable_;
|
||||
|
||||
//- 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();
|
||||
|
||||
//- Iterator set to beyond the end of the StaticHashTable
|
||||
//- Iterator set to beyond the end of the ListHashTable
|
||||
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;
|
||||
|
||||
//- 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;
|
||||
|
||||
//- const_iterator set to the beginning of the StaticHashTable
|
||||
//- const_iterator set to the beginning of the ListHashTable
|
||||
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;
|
||||
|
||||
// IOstream Operator
|
||||
@ -371,13 +369,13 @@ public:
|
||||
friend Istream& operator>> <T, Key, Hash>
|
||||
(
|
||||
Istream&,
|
||||
StaticHashTable<T, Key, Hash>&
|
||||
ListHashTable<T, Key, Hash>&
|
||||
);
|
||||
|
||||
friend Ostream& operator<< <T, Key, Hash>
|
||||
(
|
||||
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
|
||||
#include "StaticHashTable.C"
|
||||
#include "ListHashTable.C"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,13 +23,13 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "StaticHashTable.H"
|
||||
#include "ListHashTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(StaticHashTableCore, 0);
|
||||
defineTypeNameAndDebug(ListHashTableCore, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,16 +23,13 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "error.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Classes * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
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
|
||||
return Hash()(key) & (keys_.size() - 1);
|
||||
@ -42,21 +39,21 @@ Foam::StaticHashTable<T, Key, Hash>::hashKeyIndex(const Key& key) const
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
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_;
|
||||
}
|
||||
|
||||
|
||||
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_;
|
||||
}
|
||||
|
||||
|
||||
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 T& newEntry
|
||||
@ -67,7 +64,7 @@ inline bool Foam::StaticHashTable<T, Key, Hash>::insert
|
||||
|
||||
|
||||
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 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 * * * * * * * * * * * * * //
|
||||
|
||||
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);
|
||||
|
||||
@ -104,7 +93,7 @@ inline T& Foam::StaticHashTable<T, Key, Hash>::operator[](const Key& key)
|
||||
|
||||
|
||||
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
|
||||
@ -123,7 +112,7 @@ inline const T& Foam::StaticHashTable<T, Key, Hash>::operator[]
|
||||
|
||||
|
||||
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);
|
||||
|
||||
@ -143,7 +132,7 @@ inline T& Foam::StaticHashTable<T, Key, Hash>::operator()(const Key& key)
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
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,
|
||||
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 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
|
||||
)
|
||||
@ -172,7 +161,7 @@ inline Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::Iterator
|
||||
template<class T, class Key, class Hash>
|
||||
template<class TRef, class TableRef>
|
||||
inline void
|
||||
Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator=
|
||||
Foam::ListHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator=
|
||||
(
|
||||
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 TRef, class TableRef>
|
||||
inline bool
|
||||
Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator==
|
||||
Foam::ListHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator==
|
||||
(
|
||||
const iterator& iter
|
||||
) const
|
||||
@ -197,7 +186,7 @@ Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator==
|
||||
template<class T, class Key, class Hash>
|
||||
template<class TRef, class TableRef>
|
||||
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
|
||||
@ -209,7 +198,7 @@ Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator==
|
||||
template<class T, class Key, class Hash>
|
||||
template<class TRef, class TableRef>
|
||||
inline bool
|
||||
Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator!=
|
||||
Foam::ListHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator!=
|
||||
(
|
||||
const iterator& iter
|
||||
) const
|
||||
@ -221,7 +210,7 @@ Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator!=
|
||||
template<class T, class Key, class Hash>
|
||||
template<class TRef, class TableRef>
|
||||
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
|
||||
@ -233,7 +222,7 @@ Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator!=
|
||||
template<class T, class Key, class Hash>
|
||||
template<class TRef, class TableRef>
|
||||
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_];
|
||||
}
|
||||
@ -242,7 +231,7 @@ Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator*()
|
||||
template<class T, class Key, class Hash>
|
||||
template<class TRef, class TableRef>
|
||||
inline TRef
|
||||
Foam::StaticHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::operator()()
|
||||
Foam::ListHashTable<T, Key, Hash>::Iterator<TRef, TableRef>::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 TRef, class TableRef>
|
||||
inline
|
||||
typename Foam::StaticHashTable<T, Key, Hash>::template Iterator
|
||||
typename Foam::ListHashTable<T, Key, Hash>::template Iterator
|
||||
<
|
||||
TRef,
|
||||
TableRef
|
||||
>&
|
||||
Foam::StaticHashTable<T, Key, Hash>::Iterator
|
||||
Foam::ListHashTable<T, Key, Hash>::Iterator
|
||||
<
|
||||
TRef,
|
||||
TableRef
|
||||
@ -303,12 +292,12 @@ Foam::StaticHashTable<T, Key, Hash>::Iterator
|
||||
template<class T, class Key, class Hash>
|
||||
template<class TRef, class TableRef>
|
||||
inline
|
||||
typename Foam::StaticHashTable<T, Key, Hash>::template Iterator
|
||||
typename Foam::ListHashTable<T, Key, Hash>::template Iterator
|
||||
<
|
||||
TRef,
|
||||
TableRef
|
||||
>
|
||||
Foam::StaticHashTable<T, Key, Hash>::Iterator
|
||||
Foam::ListHashTable<T, Key, Hash>::Iterator
|
||||
<
|
||||
TRef,
|
||||
TableRef
|
||||
@ -326,15 +315,15 @@ Foam::StaticHashTable<T, Key, Hash>::Iterator
|
||||
template<class T, class Key, class Hash>
|
||||
template<class TRef, class TableRef>
|
||||
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_];
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
inline typename Foam::StaticHashTable<T, Key, Hash>::iterator
|
||||
Foam::StaticHashTable<T, Key, Hash>::begin()
|
||||
inline typename Foam::ListHashTable<T, Key, Hash>::iterator
|
||||
Foam::ListHashTable<T, Key, Hash>::begin()
|
||||
{
|
||||
// Find first non-empty entry
|
||||
forAll(keys_, hashIdx)
|
||||
@ -348,25 +337,25 @@ Foam::StaticHashTable<T, Key, Hash>::begin()
|
||||
#ifdef FULLDEBUG
|
||||
if (debug)
|
||||
{
|
||||
Info<< "StaticHashTable is empty\n";
|
||||
Info<< "ListHashTable is empty\n";
|
||||
}
|
||||
#endif
|
||||
|
||||
return StaticHashTable<T, Key, Hash>::endIter_;
|
||||
return ListHashTable<T, Key, Hash>::endIter_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
inline const typename Foam::StaticHashTable<T, Key, Hash>::iterator&
|
||||
Foam::StaticHashTable<T, Key, Hash>::end()
|
||||
inline const typename Foam::ListHashTable<T, Key, Hash>::iterator&
|
||||
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>
|
||||
inline typename Foam::StaticHashTable<T, Key, Hash>::const_iterator
|
||||
Foam::StaticHashTable<T, Key, Hash>::cbegin() const
|
||||
inline typename Foam::ListHashTable<T, Key, Hash>::const_iterator
|
||||
Foam::ListHashTable<T, Key, Hash>::cbegin() const
|
||||
{
|
||||
// Find first non-empty entry
|
||||
forAll(keys_, hashIdx)
|
||||
@ -380,35 +369,35 @@ Foam::StaticHashTable<T, Key, Hash>::cbegin() const
|
||||
#ifdef FULLDEBUG
|
||||
if (debug)
|
||||
{
|
||||
Info<< "StaticHashTable is empty\n";
|
||||
Info<< "ListHashTable is empty\n";
|
||||
}
|
||||
#endif
|
||||
|
||||
return StaticHashTable<T, Key, Hash>::endConstIter_;
|
||||
return ListHashTable<T, Key, Hash>::endConstIter_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
inline const typename Foam::StaticHashTable<T, Key, Hash>::const_iterator&
|
||||
Foam::StaticHashTable<T, Key, Hash>::cend() const
|
||||
inline const typename Foam::ListHashTable<T, Key, Hash>::const_iterator&
|
||||
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>
|
||||
inline typename Foam::StaticHashTable<T, Key, Hash>::const_iterator
|
||||
Foam::StaticHashTable<T, Key, Hash>::begin() const
|
||||
inline typename Foam::ListHashTable<T, Key, Hash>::const_iterator
|
||||
Foam::ListHashTable<T, Key, Hash>::begin() const
|
||||
{
|
||||
return this->cbegin();
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
inline const typename Foam::StaticHashTable<T, Key, Hash>::const_iterator&
|
||||
Foam::StaticHashTable<T, Key, Hash>::end() const
|
||||
inline const typename Foam::ListHashTable<T, Key, Hash>::const_iterator&
|
||||
Foam::ListHashTable<T, Key, Hash>::end() const
|
||||
{
|
||||
return StaticHashTable<T, Key, Hash>::endConstIter_;
|
||||
return ListHashTable<T, Key, Hash>::endConstIter_;
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,22 +23,22 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "StaticHashTable.H"
|
||||
#include "ListHashTable.H"
|
||||
#include "Istream.H"
|
||||
#include "Ostream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
Foam::StaticHashTable<T, Key, Hash>::StaticHashTable
|
||||
Foam::ListHashTable<T, Key, Hash>::ListHashTable
|
||||
(
|
||||
Istream& is,
|
||||
const label size
|
||||
)
|
||||
:
|
||||
StaticHashTableCore(),
|
||||
keys_(StaticHashTableCore::canonicalSize(size)),
|
||||
objects_(StaticHashTableCore::canonicalSize(size)),
|
||||
ListHashTableCore(),
|
||||
keys_(ListHashTableCore::canonicalSize(size)),
|
||||
objects_(ListHashTableCore::canonicalSize(size)),
|
||||
nElmts_(0),
|
||||
endIter_(*this, keys_.size(), 0),
|
||||
endConstIter_(*this, keys_.size(), 0)
|
||||
@ -46,7 +46,7 @@ Foam::StaticHashTable<T, Key, Hash>::StaticHashTable
|
||||
if (size < 1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Illegal size " << size << " for StaticHashTable."
|
||||
<< "Illegal size " << size << " for ListHashTable."
|
||||
<< " Minimum size is 1" << abort(FatalError);
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ Foam::StaticHashTable<T, Key, Hash>::StaticHashTable
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
Foam::Ostream&
|
||||
Foam::StaticHashTable<T, Key, Hash>::printInfo(Ostream& os) const
|
||||
Foam::ListHashTable<T, Key, Hash>::printInfo(Ostream& os) const
|
||||
{
|
||||
label used = 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()
|
||||
<< " chaining(avg/max):" << (used ? float(avgChain/used) : 0)
|
||||
<< "/" << maxChain << endl;
|
||||
@ -92,20 +92,20 @@ Foam::StaticHashTable<T, Key, Hash>::printInfo(Ostream& os) const
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
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
|
||||
L.clear();
|
||||
|
||||
is.fatalCheck("operator>>(Istream&, StaticHashTable<T, Key, Hash>&)");
|
||||
is.fatalCheck("operator>>(Istream&, ListHashTable<T, Key, Hash>&)");
|
||||
|
||||
token firstToken(is);
|
||||
|
||||
is.fatalCheck
|
||||
(
|
||||
"operator>>(Istream&, StaticHashTable<T, Key, Hash>&) : "
|
||||
"operator>>(Istream&, ListHashTable<T, Key, Hash>&) : "
|
||||
"reading first token"
|
||||
);
|
||||
|
||||
@ -114,7 +114,7 @@ Foam::Istream& Foam::operator>>(Istream& is, StaticHashTable<T, Key, Hash>& L)
|
||||
label s = firstToken.labelToken();
|
||||
|
||||
// Read beginning of contents
|
||||
char delimiter = is.readBeginList("StaticHashTable<T, Key, Hash>");
|
||||
char delimiter = is.readBeginList("ListHashTable<T, Key, Hash>");
|
||||
|
||||
if (s)
|
||||
{
|
||||
@ -133,7 +133,7 @@ Foam::Istream& Foam::operator>>(Istream& is, StaticHashTable<T, Key, Hash>& L)
|
||||
|
||||
is.fatalCheck
|
||||
(
|
||||
"operator>>(Istream&, StaticHashTable<T, Key, Hash>&)"
|
||||
"operator>>(Istream&, ListHashTable<T, Key, Hash>&)"
|
||||
" : reading entry"
|
||||
);
|
||||
}
|
||||
@ -149,7 +149,7 @@ Foam::Istream& Foam::operator>>(Istream& is, StaticHashTable<T, Key, Hash>& L)
|
||||
}
|
||||
|
||||
// Read end of contents
|
||||
is.readEndList("StaticHashTable");
|
||||
is.readEndList("ListHashTable");
|
||||
}
|
||||
else if (firstToken.isPunctuation())
|
||||
{
|
||||
@ -183,7 +183,7 @@ Foam::Istream& Foam::operator>>(Istream& is, StaticHashTable<T, Key, Hash>& L)
|
||||
|
||||
is.fatalCheck
|
||||
(
|
||||
"operator>>(Istream&, StaticHashTable<T, Key, Hash>&) : "
|
||||
"operator>>(Istream&, ListHashTable<T, Key, Hash>&) : "
|
||||
"reading entry"
|
||||
);
|
||||
|
||||
@ -200,7 +200,7 @@ Foam::Istream& Foam::operator>>(Istream& is, StaticHashTable<T, Key, Hash>& L)
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
is.fatalCheck("operator>>(Istream&, StaticHashTable<T, Key, Hash>&)");
|
||||
is.fatalCheck("operator>>(Istream&, ListHashTable<T, Key, Hash>&)");
|
||||
|
||||
return is;
|
||||
}
|
||||
@ -210,7 +210,7 @@ template<class T, class Key, class Hash>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const StaticHashTable<T, Key, Hash>& L)
|
||||
const ListHashTable<T, Key, Hash>& L)
|
||||
{
|
||||
// Write size and start delimiter
|
||||
os << nl << L.size() << nl << token::BEGIN_LIST << nl;
|
||||
@ -218,7 +218,7 @@ Foam::Ostream& Foam::operator<<
|
||||
// Write contents
|
||||
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
|
||||
)
|
||||
@ -230,7 +230,7 @@ Foam::Ostream& Foam::operator<<
|
||||
os << token::END_LIST;
|
||||
|
||||
// Check state of IOstream
|
||||
os.check("Ostream& operator<<(Ostream&, const StaticHashTable&)");
|
||||
os.check("Ostream& operator<<(Ostream&, const ListHashTable&)");
|
||||
|
||||
return os;
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -73,22 +73,22 @@ public:
|
||||
HashTable<T, label, Hash<label>>(is)
|
||||
{}
|
||||
|
||||
//- Construct as copy
|
||||
//- Copy constructor
|
||||
Map(const Map<T>& map)
|
||||
:
|
||||
HashTable<T, label, Hash<label>>(map)
|
||||
{}
|
||||
|
||||
//- Construct by transferring the parameter contents
|
||||
Map(const Xfer<Map<T>>& map)
|
||||
//- Move constructor
|
||||
Map(Map<T>&& map)
|
||||
:
|
||||
HashTable<T, label, Hash<label>>(map)
|
||||
HashTable<T, label, Hash<label>>(move(map))
|
||||
{}
|
||||
|
||||
//- Construct by transferring the parameter contents
|
||||
Map(const Xfer<HashTable<T, label, Hash<label>>>& map)
|
||||
//- Move constructor
|
||||
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
|
||||
@ -96,6 +96,19 @@ public:
|
||||
:
|
||||
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
Reference in New Issue
Block a user