Merge branch 'feature-memory-containers' into 'develop'
Feature memory containers See merge request Development/OpenFOAM-plus!192
This commit is contained in:
@ -165,7 +165,7 @@ IOdictionary PDRProperties
|
||||
autoPtr<PDRDragModel> drag = PDRDragModel::New
|
||||
(
|
||||
PDRProperties,
|
||||
turbulence,
|
||||
*turbulence,
|
||||
rho,
|
||||
U,
|
||||
phi
|
||||
@ -176,7 +176,7 @@ autoPtr<XiModel> flameWrinkling = XiModel::New
|
||||
(
|
||||
PDRProperties,
|
||||
thermo,
|
||||
turbulence,
|
||||
*turbulence,
|
||||
Su,
|
||||
rho,
|
||||
b,
|
||||
|
||||
@ -1,8 +1,5 @@
|
||||
Info<< "Constructing single cell mesh" << nl << endl;
|
||||
|
||||
labelList owner(6, label(0));
|
||||
labelList neighbour(0);
|
||||
|
||||
pointField points(8);
|
||||
points[0] = vector(0, 0, 0);
|
||||
points[1] = vector(1, 0, 0);
|
||||
@ -24,10 +21,10 @@ fvMesh mesh
|
||||
runTime,
|
||||
IOobject::READ_IF_PRESENT
|
||||
),
|
||||
xferMove<pointField>(points),
|
||||
faces.xfer(),
|
||||
owner.xfer(),
|
||||
neighbour.xfer()
|
||||
std::move(points),
|
||||
std::move(faces),
|
||||
labelList(6, Zero), // owner
|
||||
labelList() // neighbour
|
||||
);
|
||||
|
||||
List<polyPatch*> patches(1);
|
||||
|
||||
@ -101,7 +101,7 @@ if (mesh.changing())
|
||||
pcorrEqn.setReferences
|
||||
(
|
||||
validCells,
|
||||
scalarList(validCells.size(), 0.0),
|
||||
scalar(0.0),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
@ -89,22 +89,22 @@ public:
|
||||
|
||||
const rhoThermo& thermo1() const
|
||||
{
|
||||
return thermo1_();
|
||||
return *thermo1_;
|
||||
}
|
||||
|
||||
const rhoThermo& thermo2() const
|
||||
{
|
||||
return thermo2_();
|
||||
return *thermo2_;
|
||||
}
|
||||
|
||||
rhoThermo& thermo1()
|
||||
{
|
||||
return thermo1_();
|
||||
return *thermo1_;
|
||||
}
|
||||
|
||||
rhoThermo& thermo2()
|
||||
{
|
||||
return thermo2_();
|
||||
return *thermo2_;
|
||||
}
|
||||
|
||||
//- Correct the thermodynamics of each phase
|
||||
|
||||
@ -81,7 +81,7 @@ Foam::phaseModel::phaseModel
|
||||
Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::clone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<phaseModel>(nullptr);
|
||||
return autoPtr<phaseModel>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -100,7 +100,7 @@ public:
|
||||
|
||||
autoPtr<phaseModel> operator()(Istream& is) const
|
||||
{
|
||||
return autoPtr<phaseModel>(new phaseModel(is, p_, T_));
|
||||
return autoPtr<phaseModel>::New(is, p_, T_);
|
||||
}
|
||||
};
|
||||
|
||||
@ -120,13 +120,13 @@ public:
|
||||
//- Return const-access to phase rhoThermo
|
||||
const rhoThermo& thermo() const
|
||||
{
|
||||
return thermo_();
|
||||
return *thermo_;
|
||||
}
|
||||
|
||||
//- Return access to phase rhoThermo
|
||||
rhoThermo& thermo()
|
||||
{
|
||||
return thermo_();
|
||||
return *thermo_;
|
||||
}
|
||||
|
||||
//- Return const-access to phase divergence
|
||||
|
||||
@ -106,13 +106,13 @@ public:
|
||||
//- Return const-access to the mixture viscosityModel
|
||||
const mixtureViscosityModel& muModel() const
|
||||
{
|
||||
return muModel_();
|
||||
return *muModel_;
|
||||
}
|
||||
|
||||
//- Return const-access to the continuous-phase viscosityModel
|
||||
const viscosityModel& nucModel() const
|
||||
{
|
||||
return nucModel_();
|
||||
return *nucModel_;
|
||||
}
|
||||
|
||||
//- Return const-access to the dispersed-phase density
|
||||
|
||||
@ -181,19 +181,19 @@ public:
|
||||
//- Return const-access to phase1 viscosityModel
|
||||
const viscosityModel& nuModel1() const
|
||||
{
|
||||
return nuModel1_();
|
||||
return *nuModel1_;
|
||||
}
|
||||
|
||||
//- Return const-access to phase2 viscosityModel
|
||||
const viscosityModel& nuModel2() const
|
||||
{
|
||||
return nuModel2_();
|
||||
return *nuModel2_;
|
||||
}
|
||||
|
||||
//- Return const-access to phase3 viscosityModel
|
||||
const viscosityModel& nuModel3() const
|
||||
{
|
||||
return nuModel3_();
|
||||
return *nuModel3_;
|
||||
}
|
||||
|
||||
//- Return the dynamic laminar viscosity
|
||||
|
||||
@ -110,7 +110,7 @@
|
||||
pcorrEqn.setReferences
|
||||
(
|
||||
validCells,
|
||||
scalarList(validCells.size(), 0.0),
|
||||
scalar(0.0),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
@ -205,7 +205,7 @@ Foam::phaseModel::~phaseModel()
|
||||
Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::clone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<phaseModel>(nullptr);
|
||||
return autoPtr<phaseModel>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -190,12 +190,12 @@ public:
|
||||
|
||||
const surfaceScalarField& phi() const
|
||||
{
|
||||
return phiPtr_();
|
||||
return *phiPtr_;
|
||||
}
|
||||
|
||||
surfaceScalarField& phi()
|
||||
{
|
||||
return phiPtr_();
|
||||
return *phiPtr_;
|
||||
}
|
||||
|
||||
const surfaceScalarField& alphaPhi() const
|
||||
|
||||
@ -68,7 +68,7 @@ Foam::phase::phase
|
||||
Foam::autoPtr<Foam::phase> Foam::phase::clone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<phase>(nullptr);
|
||||
return autoPtr<phase>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -120,7 +120,7 @@ public:
|
||||
//- Return const-access to phase1 viscosityModel
|
||||
const viscosityModel& nuModel() const
|
||||
{
|
||||
return nuModel_();
|
||||
return *nuModel_;
|
||||
}
|
||||
|
||||
//- Return the kinematic laminar viscosity
|
||||
|
||||
@ -59,14 +59,9 @@ HeatAndMassTransferPhaseSystem
|
||||
massTransferModels_
|
||||
);
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
this->phasePairs_,
|
||||
phasePairIter
|
||||
)
|
||||
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||
{
|
||||
const phasePair& pair(phasePairIter());
|
||||
const phasePair& pair = *(phasePairIter.object());
|
||||
|
||||
if (pair.ordered())
|
||||
{
|
||||
@ -197,14 +192,9 @@ Foam::HeatAndMassTransferPhaseSystem<BasePhaseSystem>::dmdt
|
||||
)
|
||||
);
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
this->phasePairs_,
|
||||
phasePairIter
|
||||
)
|
||||
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||
{
|
||||
const phasePair& pair(phasePairIter());
|
||||
const phasePair& pair = *(phasePairIter.object());
|
||||
|
||||
if (pair.ordered())
|
||||
{
|
||||
@ -239,14 +229,9 @@ Foam::HeatAndMassTransferPhaseSystem<BasePhaseSystem>::momentumTransfer() const
|
||||
phaseSystem::momentumTransferTable& eqns = eqnsPtr();
|
||||
|
||||
// Source term due to mass trasfer
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
this->phasePairs_,
|
||||
phasePairIter
|
||||
)
|
||||
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||
{
|
||||
const phasePair& pair(phasePairIter());
|
||||
const phasePair& pair = *(phasePairIter.object());
|
||||
|
||||
if (pair.ordered())
|
||||
{
|
||||
@ -291,17 +276,10 @@ Foam::HeatAndMassTransferPhaseSystem<BasePhaseSystem>::heatTransfer() const
|
||||
}
|
||||
|
||||
// Heat transfer with the interface
|
||||
forAllConstIter
|
||||
(
|
||||
heatTransferModelTable,
|
||||
heatTransferModels_,
|
||||
heatTransferModelIter
|
||||
)
|
||||
forAllConstIters(heatTransferModels_, heatTransferModelIter)
|
||||
{
|
||||
const phasePair& pair
|
||||
(
|
||||
this->phasePairs_[heatTransferModelIter.key()]
|
||||
);
|
||||
const phasePair& pair =
|
||||
*(this->phasePairs_[heatTransferModelIter.key()]);
|
||||
|
||||
const phaseModel* phase = &pair.phase1();
|
||||
const phaseModel* otherPhase = &pair.phase2();
|
||||
@ -344,14 +322,9 @@ Foam::HeatAndMassTransferPhaseSystem<BasePhaseSystem>::heatTransfer() const
|
||||
}
|
||||
|
||||
// Source term due to mass transfer
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
this->phasePairs_,
|
||||
phasePairIter
|
||||
)
|
||||
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||
{
|
||||
const phasePair& pair(phasePairIter());
|
||||
const phasePair& pair = *(phasePairIter.object());
|
||||
|
||||
if (pair.ordered())
|
||||
{
|
||||
|
||||
@ -128,16 +128,12 @@ Foam::HeatTransferPhaseSystem<BasePhaseSystem>::heatTransfer() const
|
||||
);
|
||||
}
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
heatTransferModelTable,
|
||||
heatTransferModels_,
|
||||
heatTransferModelIter
|
||||
)
|
||||
forAllConstIters(heatTransferModels_, heatTransferModelIter)
|
||||
{
|
||||
const volScalarField K(heatTransferModelIter()->K());
|
||||
const phasePair& pair =
|
||||
*(this->phasePairs_[heatTransferModelIter.key()]);
|
||||
|
||||
const phasePair& pair(this->phasePairs_[heatTransferModelIter.key()]);
|
||||
const volScalarField K(heatTransferModelIter()->K());
|
||||
|
||||
const phaseModel* phase = &pair.phase1();
|
||||
const phaseModel* otherPhase = &pair.phase2();
|
||||
|
||||
@ -86,14 +86,9 @@ massTransfer() const
|
||||
}
|
||||
|
||||
// Reset the interfacial mass flow rates
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
this->phasePairs_,
|
||||
phasePairIter
|
||||
)
|
||||
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||
{
|
||||
const phasePair& pair(phasePairIter());
|
||||
const phasePair& pair = *(phasePairIter.object());
|
||||
|
||||
if (pair.ordered())
|
||||
{
|
||||
@ -108,22 +103,18 @@ massTransfer() const
|
||||
}
|
||||
|
||||
// Sum up the contribution from each interface composition model
|
||||
forAllConstIter
|
||||
forAllConstIters
|
||||
(
|
||||
interfaceCompositionModelTable,
|
||||
interfaceCompositionModels_,
|
||||
interfaceCompositionModelIter
|
||||
)
|
||||
{
|
||||
const interfaceCompositionModel& compositionModel
|
||||
(
|
||||
interfaceCompositionModelIter()
|
||||
);
|
||||
const phasePair& pair =
|
||||
*(this->phasePairs_[interfaceCompositionModelIter.key()]);
|
||||
|
||||
const interfaceCompositionModel& compositionModel =
|
||||
*(interfaceCompositionModelIter.object());
|
||||
|
||||
const phasePair& pair
|
||||
(
|
||||
this->phasePairs_[interfaceCompositionModelIter.key()]
|
||||
);
|
||||
const phaseModel& phase = pair.phase1();
|
||||
const phaseModel& otherPhase = pair.phase2();
|
||||
const phasePairKey key(phase.name(), otherPhase.name());
|
||||
@ -209,14 +200,9 @@ correctThermo()
|
||||
// Yfi is likely to be a strong non-linear (typically exponential) function
|
||||
// of Tf, so the solution for the temperature is newton-accelerated
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
this->phasePairs_,
|
||||
phasePairIter
|
||||
)
|
||||
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||
{
|
||||
const phasePair& pair(phasePairIter());
|
||||
const phasePair& pair = *(phasePairIter.object());
|
||||
|
||||
if (pair.ordered())
|
||||
{
|
||||
|
||||
@ -82,14 +82,10 @@ MomentumTransferPhaseSystem
|
||||
turbulentDispersionModels_
|
||||
);
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
dragModelTable,
|
||||
dragModels_,
|
||||
dragModelIter
|
||||
)
|
||||
forAllConstIters(dragModels_, dragModelIter)
|
||||
{
|
||||
const phasePair& pair(this->phasePairs_[dragModelIter.key()]);
|
||||
const phasePair& pair =
|
||||
*(this->phasePairs_[dragModelIter.key()]);
|
||||
|
||||
Kds_.insert
|
||||
(
|
||||
@ -102,14 +98,10 @@ MomentumTransferPhaseSystem
|
||||
);
|
||||
}
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
virtualMassModelTable,
|
||||
virtualMassModels_,
|
||||
virtualMassModelIter
|
||||
)
|
||||
forAllConstIters(virtualMassModels_, virtualMassModelIter)
|
||||
{
|
||||
const phasePair& pair(this->phasePairs_[virtualMassModelIter.key()]);
|
||||
const phasePair& pair =
|
||||
*(this->phasePairs_[virtualMassModelIter.key()]);
|
||||
|
||||
Vms_.insert
|
||||
(
|
||||
@ -183,16 +175,11 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::Kd
|
||||
)
|
||||
);
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::KdTable,
|
||||
Kds_,
|
||||
KdIter
|
||||
)
|
||||
forAllConstIters(Kds_, KdIter)
|
||||
{
|
||||
const volScalarField& K(*KdIter());
|
||||
const phasePair& pair = *(this->phasePairs_[KdIter.key()]);
|
||||
|
||||
const phasePair& pair(this->phasePairs_[KdIter.key()]);
|
||||
const volScalarField& K(*KdIter());
|
||||
|
||||
const phaseModel* phase1 = &pair.phase1();
|
||||
const phaseModel* phase2 = &pair.phase2();
|
||||
@ -430,27 +417,17 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::momentumTransfer() const
|
||||
}
|
||||
|
||||
// Update the drag coefficients
|
||||
forAllConstIter
|
||||
(
|
||||
dragModelTable,
|
||||
dragModels_,
|
||||
dragModelIter
|
||||
)
|
||||
forAllConstIters(dragModels_, dragModelIter)
|
||||
{
|
||||
*Kds_[dragModelIter.key()] = dragModelIter()->K();
|
||||
}
|
||||
|
||||
// Add the implicit part of the drag force
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::KdTable,
|
||||
Kds_,
|
||||
KdIter
|
||||
)
|
||||
forAllConstIters(Kds_, KdIter)
|
||||
{
|
||||
const volScalarField& K(*KdIter());
|
||||
const phasePair& pair = *(this->phasePairs_[KdIter.key()]);
|
||||
|
||||
const phasePair& pair(this->phasePairs_[KdIter.key()]);
|
||||
const volScalarField& K(*KdIter());
|
||||
|
||||
const phaseModel* phase = &pair.phase1();
|
||||
const phaseModel* otherPhase = &pair.phase2();
|
||||
@ -466,27 +443,17 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::momentumTransfer() const
|
||||
}
|
||||
|
||||
// Update the virtual mass coefficients
|
||||
forAllConstIter
|
||||
(
|
||||
virtualMassModelTable,
|
||||
virtualMassModels_,
|
||||
virtualMassModelIter
|
||||
)
|
||||
forAllConstIters(virtualMassModels_, virtualMassModelIter)
|
||||
{
|
||||
*Vms_[virtualMassModelIter.key()] = virtualMassModelIter()->K();
|
||||
}
|
||||
|
||||
// Add the virtual mass force
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::VmTable,
|
||||
Vms_,
|
||||
VmIter
|
||||
)
|
||||
forAllConstIters(Vms_, VmIter)
|
||||
{
|
||||
const volScalarField& Vm(*VmIter());
|
||||
const phasePair& pair = *(this->phasePairs_[VmIter.key()]);
|
||||
|
||||
const phasePair& pair(this->phasePairs_[VmIter.key()]);
|
||||
const volScalarField& Vm(*VmIter());
|
||||
|
||||
const phaseModel* phase = &pair.phase1();
|
||||
const phaseModel* otherPhase = &pair.phase2();
|
||||
@ -557,33 +524,22 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::Fs() const
|
||||
PtrList<volVectorField>& Fs = tFs();
|
||||
|
||||
// Add the lift force
|
||||
forAllConstIter
|
||||
(
|
||||
liftModelTable,
|
||||
liftModels_,
|
||||
liftModelIter
|
||||
)
|
||||
forAllConstIters(liftModels_, modelIter)
|
||||
{
|
||||
const volVectorField F(liftModelIter()->F<vector>());
|
||||
const phasePair& pair = *(this->phasePairs_[modelIter.key()]);
|
||||
|
||||
const phasePair& pair(this->phasePairs_[liftModelIter.key()]);
|
||||
const volVectorField F(modelIter()->template F<vector>());
|
||||
|
||||
setF(Fs, pair.phase1().index()) += F;
|
||||
setF(Fs, pair.phase2().index()) -= F;
|
||||
}
|
||||
|
||||
// Add the wall lubrication force
|
||||
forAllConstIter
|
||||
(
|
||||
wallLubricationModelTable,
|
||||
wallLubricationModels_,
|
||||
wallLubricationModelIter
|
||||
)
|
||||
forAllConstIters(wallLubricationModels_, modelIter)
|
||||
{
|
||||
const volVectorField F(wallLubricationModelIter()->F<vector>());
|
||||
const phasePair& pair = *(this->phasePairs_[modelIter.key()]);
|
||||
|
||||
const phasePair&
|
||||
pair(this->phasePairs_[wallLubricationModelIter.key()]);
|
||||
const volVectorField F(modelIter()->template F<vector>());
|
||||
|
||||
setF(Fs, pair.phase1().index()) += F;
|
||||
setF(Fs, pair.phase2().index()) -= F;
|
||||
@ -647,15 +603,10 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::phiDs
|
||||
PtrList<surfaceScalarField>& phiDs = tphiDs();
|
||||
|
||||
// Add the turbulent dispersion force
|
||||
forAllConstIter
|
||||
(
|
||||
turbulentDispersionModelTable,
|
||||
turbulentDispersionModels_,
|
||||
turbulentDispersionModelIter
|
||||
)
|
||||
forAllConstIters(turbulentDispersionModels_, turbulentDispersionModelIter)
|
||||
{
|
||||
const phasePair&
|
||||
pair(this->phasePairs_[turbulentDispersionModelIter.key()]);
|
||||
const phasePair& pair =
|
||||
*(this->phasePairs_[turbulentDispersionModelIter.key()]);
|
||||
|
||||
const volScalarField D(turbulentDispersionModelIter()->D());
|
||||
const surfaceScalarField snGradAlpha1
|
||||
|
||||
@ -42,14 +42,9 @@ ThermalPhaseChangePhaseSystem
|
||||
massTransfer_(this->lookup("massTransfer"))
|
||||
{
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
this->phasePairs_,
|
||||
phasePairIter
|
||||
)
|
||||
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||
{
|
||||
const phasePair& pair(phasePairIter());
|
||||
const phasePair& pair = *(phasePairIter.object());
|
||||
|
||||
if (pair.ordered())
|
||||
{
|
||||
@ -92,7 +87,7 @@ template<class BasePhaseSystem>
|
||||
const Foam::saturationModel&
|
||||
Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::saturation() const
|
||||
{
|
||||
return saturationModel_();
|
||||
return *saturationModel_;
|
||||
}
|
||||
|
||||
|
||||
@ -109,14 +104,9 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::heatTransfer() const
|
||||
phaseSystem::heatTransferTable& eqns = eqnsPtr();
|
||||
|
||||
// Accumulate mDotL contributions from boundaries
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
this->phasePairs_,
|
||||
phasePairIter
|
||||
)
|
||||
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||
{
|
||||
const phasePair& pair(phasePairIter());
|
||||
const phasePair& pair = *(phasePairIter.object());
|
||||
|
||||
if (pair.ordered())
|
||||
{
|
||||
@ -219,19 +209,15 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::massTransfer() const
|
||||
}
|
||||
}
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
this->phasePairs_,
|
||||
phasePairIter
|
||||
)
|
||||
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||
{
|
||||
const phasePair& pair(phasePairIter());
|
||||
const phasePair& pair = *(phasePairIter.object());
|
||||
|
||||
if (pair.ordered())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const phaseModel& phase = pair.phase1();
|
||||
const phaseModel& otherPhase = pair.phase2();
|
||||
|
||||
@ -292,14 +278,9 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::iDmdt
|
||||
)
|
||||
);
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
this->phasePairs_,
|
||||
phasePairIter
|
||||
)
|
||||
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||
{
|
||||
const phasePair& pair(phasePairIter());
|
||||
const phasePair& pair = *(phasePairIter.object());
|
||||
|
||||
if (pair.ordered())
|
||||
{
|
||||
@ -332,14 +313,9 @@ void Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctThermo()
|
||||
|
||||
BasePhaseSystem::correctThermo();
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
this->phasePairs_,
|
||||
phasePairIter
|
||||
)
|
||||
forAllConstIters(this->phasePairs_, phasePairIter)
|
||||
{
|
||||
const phasePair& pair(phasePairIter());
|
||||
const phasePair& pair = *(phasePairIter.object());
|
||||
|
||||
if (pair.ordered())
|
||||
{
|
||||
|
||||
@ -401,7 +401,7 @@ template<class BasePhaseModel>
|
||||
const Foam::phaseCompressibleTurbulenceModel&
|
||||
Foam::MovingPhaseModel<BasePhaseModel>::turbulence() const
|
||||
{
|
||||
return turbulence_;
|
||||
return *turbulence_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ Foam::phaseModel::phaseModel
|
||||
Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::clone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<phaseModel>(nullptr);
|
||||
return autoPtr<phaseModel>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -48,8 +48,8 @@ void Foam::phaseSystem::createSubModels
|
||||
key,
|
||||
modelType::New
|
||||
(
|
||||
*iter,
|
||||
phasePairs_[key]
|
||||
iter.object(),
|
||||
phasePairs_[key]()
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -98,11 +98,11 @@ void Foam::phaseSystem::generatePairsAndSubModels
|
||||
const blendingMethod& blending
|
||||
(
|
||||
blendingMethods_.found(modelName)
|
||||
? blendingMethods_[modelName]
|
||||
: blendingMethods_["default"]
|
||||
? *(blendingMethods_[modelName])
|
||||
: *(blendingMethods_["default"])
|
||||
);
|
||||
|
||||
autoPtr<modelType> noModel(nullptr);
|
||||
autoPtr<modelType> noModel;
|
||||
|
||||
forAllConstIter(typename modelTypeTable, tempModels, iter)
|
||||
{
|
||||
|
||||
@ -217,16 +217,11 @@ while (pimple.correct())
|
||||
)
|
||||
);
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::KdTable,
|
||||
fluid.Kds(),
|
||||
KdIter
|
||||
)
|
||||
forAllConstIters(fluid.Kds(), KdIter)
|
||||
{
|
||||
const volScalarField& K(*KdIter());
|
||||
|
||||
const phasePair& pair(fluid.phasePairs()[KdIter.key()]);
|
||||
const phasePair& pair = *(fluid.phasePairs()[KdIter.key()]);
|
||||
|
||||
const phaseModel* phase1 = &pair.phase1();
|
||||
const phaseModel* phase2 = &pair.phase2();
|
||||
|
||||
@ -115,7 +115,7 @@ public:
|
||||
autoPtr<IATEsource> clone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<IATEsource>(nullptr);
|
||||
return autoPtr<IATEsource>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -451,9 +451,11 @@ bool Foam::BlendedInterfacialModel<modelType>::hasModel
|
||||
) const
|
||||
{
|
||||
return
|
||||
&phase == &(pair_.phase1())
|
||||
(
|
||||
&phase == &(pair_.phase1())
|
||||
? model1In2_.valid()
|
||||
: model2In1_.valid();
|
||||
: model2In1_.valid()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -463,7 +465,7 @@ const modelType& Foam::BlendedInterfacialModel<modelType>::phaseModel
|
||||
const class phaseModel& phase
|
||||
) const
|
||||
{
|
||||
return &phase == &(pair_.phase1()) ? model1In2_ : model2In1_;
|
||||
return &phase == &(pair_.phase1()) ? *model1In2_ : *model2In1_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@ public:
|
||||
autoPtr<IATEsource> clone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<IATEsource>(nullptr);
|
||||
return autoPtr<IATEsource>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -227,14 +227,14 @@ Foam::tmp<Foam::volScalarField> Foam::phaseModel::d() const
|
||||
Foam::PhaseCompressibleTurbulenceModel<Foam::phaseModel>&
|
||||
Foam::phaseModel::turbulence()
|
||||
{
|
||||
return turbulence_();
|
||||
return *turbulence_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::PhaseCompressibleTurbulenceModel<Foam::phaseModel>&
|
||||
Foam::phaseModel::turbulence() const
|
||||
{
|
||||
return turbulence_();
|
||||
return *turbulence_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -162,14 +162,14 @@ public:
|
||||
//- Return the thermophysical model
|
||||
const rhoThermo& thermo() const
|
||||
{
|
||||
return thermo_();
|
||||
return *thermo_;
|
||||
}
|
||||
|
||||
//- Return non-const access to the thermophysical model
|
||||
// for correction
|
||||
rhoThermo& thermo()
|
||||
{
|
||||
return thermo_();
|
||||
return *thermo_;
|
||||
}
|
||||
|
||||
//- Return the laminar viscosity
|
||||
@ -286,13 +286,13 @@ public:
|
||||
//- Return the volumetric flux
|
||||
const surfaceScalarField& phi() const
|
||||
{
|
||||
return phiPtr_();
|
||||
return *phiPtr_;
|
||||
}
|
||||
|
||||
//- Return non-const access to the volumetric flux
|
||||
surfaceScalarField& phi()
|
||||
{
|
||||
return phiPtr_();
|
||||
return *phiPtr_;
|
||||
}
|
||||
|
||||
//- Return the volumetric flux of the phase
|
||||
|
||||
@ -177,12 +177,12 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
||||
lookup("drag"),
|
||||
(
|
||||
blendingMethods_.found("drag")
|
||||
? blendingMethods_["drag"]
|
||||
: blendingMethods_["default"]
|
||||
? *(blendingMethods_["drag"])
|
||||
: *(blendingMethods_["default"])
|
||||
),
|
||||
pair_,
|
||||
pair1In2_,
|
||||
pair2In1_,
|
||||
*pair_,
|
||||
*pair1In2_,
|
||||
*pair2In1_,
|
||||
false // Do not zero drag coefficent at fixed-flux BCs
|
||||
)
|
||||
);
|
||||
@ -194,12 +194,12 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
||||
lookup("virtualMass"),
|
||||
(
|
||||
blendingMethods_.found("virtualMass")
|
||||
? blendingMethods_["virtualMass"]
|
||||
: blendingMethods_["default"]
|
||||
? *(blendingMethods_["virtualMass"])
|
||||
: *(blendingMethods_["default"])
|
||||
),
|
||||
pair_,
|
||||
pair1In2_,
|
||||
pair2In1_
|
||||
*pair_,
|
||||
*pair1In2_,
|
||||
*pair2In1_
|
||||
)
|
||||
);
|
||||
|
||||
@ -210,12 +210,12 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
||||
lookup("heatTransfer"),
|
||||
(
|
||||
blendingMethods_.found("heatTransfer")
|
||||
? blendingMethods_["heatTransfer"]
|
||||
: blendingMethods_["default"]
|
||||
? *(blendingMethods_["heatTransfer"])
|
||||
: *(blendingMethods_["default"])
|
||||
),
|
||||
pair_,
|
||||
pair1In2_,
|
||||
pair2In1_
|
||||
*pair_,
|
||||
*pair1In2_,
|
||||
*pair2In1_
|
||||
)
|
||||
);
|
||||
|
||||
@ -226,12 +226,12 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
||||
lookup("lift"),
|
||||
(
|
||||
blendingMethods_.found("lift")
|
||||
? blendingMethods_["lift"]
|
||||
: blendingMethods_["default"]
|
||||
? *(blendingMethods_["lift"])
|
||||
: *(blendingMethods_["default"])
|
||||
),
|
||||
pair_,
|
||||
pair1In2_,
|
||||
pair2In1_
|
||||
*pair_,
|
||||
*pair1In2_,
|
||||
*pair2In1_
|
||||
)
|
||||
);
|
||||
|
||||
@ -242,12 +242,12 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
||||
lookup("wallLubrication"),
|
||||
(
|
||||
blendingMethods_.found("wallLubrication")
|
||||
? blendingMethods_["wallLubrication"]
|
||||
: blendingMethods_["default"]
|
||||
? *(blendingMethods_["wallLubrication"])
|
||||
: *(blendingMethods_["default"])
|
||||
),
|
||||
pair_,
|
||||
pair1In2_,
|
||||
pair2In1_
|
||||
*pair_,
|
||||
*pair1In2_,
|
||||
*pair2In1_
|
||||
)
|
||||
);
|
||||
|
||||
@ -258,12 +258,12 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
||||
lookup("turbulentDispersion"),
|
||||
(
|
||||
blendingMethods_.found("turbulentDispersion")
|
||||
? blendingMethods_["turbulentDispersion"]
|
||||
: blendingMethods_["default"]
|
||||
? *(blendingMethods_["turbulentDispersion"])
|
||||
: *(blendingMethods_["default"])
|
||||
),
|
||||
pair_,
|
||||
pair1In2_,
|
||||
pair2In1_
|
||||
*pair_,
|
||||
*pair1In2_,
|
||||
*pair2In1_
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -272,7 +272,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::twoPhaseSystem::~twoPhaseSystem()
|
||||
{}
|
||||
{} // Define here (incomplete type in header)
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
@ -16,7 +16,7 @@ volVectorField D
|
||||
);
|
||||
|
||||
|
||||
autoPtr<volScalarField> Tptr(nullptr);
|
||||
autoPtr<volScalarField> Tptr;
|
||||
|
||||
if (thermalStress)
|
||||
{
|
||||
|
||||
@ -180,7 +180,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
std::cout<< "iter: " << typeid(*iter).name() << '\n';
|
||||
|
||||
Info<< "elem = " << *(*iter) << endl;
|
||||
// Info<< "elem = " << *(*iter) << endl;
|
||||
}
|
||||
|
||||
std::cout<< "iter type: "
|
||||
|
||||
@ -194,13 +194,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
printInfo("dlC", dlC, true);
|
||||
|
||||
List<label> lstB(dlC.xfer());
|
||||
List<label> lstB(std::move(dlC));
|
||||
|
||||
Info<< "Transferred to normal list via the xfer() method" << endl;
|
||||
Info<< "Move construct to normal list" << endl;
|
||||
printInfo("lstB", lstB, true);
|
||||
printInfo("dlC", dlC, true);
|
||||
|
||||
DynamicList<label> dlD(lstB.xfer());
|
||||
DynamicList<label> dlD(std::move(lstB));
|
||||
|
||||
Info<< "Transfer construct from normal list" << endl;
|
||||
printInfo("lstB", lstB, true);
|
||||
@ -279,7 +279,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "list in: " << flatOutput(list1) << nl
|
||||
<< "list out: " << flatOutput(list2) << endl;
|
||||
|
||||
input2 = std::move(identity(15));
|
||||
input2 = identity(15); // don't need std::move() on temporary object
|
||||
list2 = std::move(input2);
|
||||
Info<< "list in: " << flatOutput(input2) << nl
|
||||
<< "list out: " << flatOutput(list2) << endl;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -27,13 +27,50 @@ Description
|
||||
|
||||
#include "hashedWordList.H"
|
||||
#include "nil.H"
|
||||
#include "HashOps.H"
|
||||
#include "HashSet.H"
|
||||
#include "Map.H"
|
||||
#include "labelPairHashes.H"
|
||||
#include "FlatOutput.H"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
template<class Iter>
|
||||
void printIf(const Iter& iter)
|
||||
{
|
||||
if (iter.found())
|
||||
{
|
||||
Info<< *iter;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<<"(null)";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Key, class Hash>
|
||||
void printMinMax(const HashSet<Key, Hash>& set)
|
||||
{
|
||||
const auto first = set.cbegin();
|
||||
const auto last = set.cend();
|
||||
|
||||
const auto min = std::min_element(first, last);
|
||||
const auto max = std::max_element(first, last);
|
||||
|
||||
Info<< "set: " << flatOutput(set) << nl;
|
||||
Info<< " min=";
|
||||
printIf(min);
|
||||
Info<< nl;
|
||||
|
||||
Info<< " max=";
|
||||
printIf(max);
|
||||
Info<< nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
@ -131,9 +168,14 @@ int main(int argc, char *argv[])
|
||||
Info<< "create from Map<label>: ";
|
||||
Info<< labelHashSet(mapA) << endl;
|
||||
|
||||
Info<<"combined toc: "
|
||||
<< (wordHashSet(setA) | wordHashSet(tableA) | wordHashSet(tableB))
|
||||
<< nl;
|
||||
{
|
||||
auto allToc =
|
||||
(wordHashSet(setA) | wordHashSet(tableA) | wordHashSet(tableB));
|
||||
|
||||
Info<<"combined toc: " << flatOutput(allToc) << nl;
|
||||
|
||||
printMinMax(allToc);
|
||||
}
|
||||
|
||||
labelHashSet setB
|
||||
{
|
||||
@ -226,6 +268,12 @@ int main(int argc, char *argv[])
|
||||
Info << i << endl;
|
||||
}
|
||||
|
||||
printMinMax(setD);
|
||||
Info<< nl;
|
||||
|
||||
printMinMax(labelHashSet());
|
||||
Info<< nl;
|
||||
|
||||
Info<< nl << "Test swapping, moving etc." << nl;
|
||||
setA.insert({ "some", "more", "entries" });
|
||||
|
||||
|
||||
@ -102,7 +102,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "transfer contents to a List" << endl;
|
||||
|
||||
IListStream ibuf(obuf.xfer());
|
||||
IListStream ibuf;
|
||||
|
||||
// Reclaim data storage from OListStream -> IListStream
|
||||
{
|
||||
List<char> data;
|
||||
obuf.swap(data);
|
||||
ibuf.swap(data);
|
||||
}
|
||||
|
||||
Info<< nl;
|
||||
Info<< nl << "input string:";
|
||||
|
||||
@ -95,7 +95,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
inplaceReverseList(addresses);
|
||||
|
||||
idl1.resetAddressing(addresses.xfer());
|
||||
idl1.resetAddressing(std::move(addresses));
|
||||
|
||||
printInfo(idl1);
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -43,6 +43,7 @@ See also
|
||||
|
||||
#include "labelRange.H"
|
||||
#include "scalarList.H"
|
||||
#include "HashOps.H"
|
||||
#include "ListOps.H"
|
||||
#include "SubList.H"
|
||||
|
||||
@ -97,11 +98,14 @@ void printMyString(const UList<string>& lst)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noParallel();
|
||||
argList::noFunctionObjects();
|
||||
|
||||
argList::addOption("reList", "reList");
|
||||
argList::addOption("wordList", "wordList");
|
||||
argList::addOption("stringList", "stringList");
|
||||
argList::addOption("float", "xx");
|
||||
argList::addBoolOption("transform", "Test List::createList functionality");
|
||||
argList::addBoolOption("create", "Test ListOps::create functionality");
|
||||
argList::addBoolOption("ListList", "Test list of list functionality");
|
||||
argList::addBoolOption("flag");
|
||||
|
||||
#include "setRootCase.H"
|
||||
@ -186,8 +190,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(std::move(list2));
|
||||
Info<< "Move construct" << endl;
|
||||
Info<< "list2: " << list2 << nl
|
||||
<< "list3: " << list3 << endl;
|
||||
|
||||
@ -332,11 +336,11 @@ int main(int argc, char *argv[])
|
||||
List<scalar> sident(range.begin(), range.end());
|
||||
Info<<"range-list (scalar)=" << sident << nl;
|
||||
|
||||
// Sub-ranges also work
|
||||
List<scalar> sident2(range(3), range(10));
|
||||
Info<<"range-list (scalar)=" << sident2 << nl;
|
||||
// // Sub-ranges also work
|
||||
// List<scalar> sident2(range.at(3), range.at(10));
|
||||
// Info<<"subrange-list (scalar)=" << sident2 << nl;
|
||||
|
||||
// VERY BAD IDEA: List<scalar> sident3(range(10), range(3));
|
||||
// VERY BAD IDEA: List<scalar> sident3(range.at(10), range.at(3));
|
||||
|
||||
// This doesn't work, and don't know what it should do anyhow
|
||||
// List<vector> vident(range.begin(), range.end());
|
||||
@ -362,15 +366,15 @@ int main(int argc, char *argv[])
|
||||
Info<<"-flag:" << args["flag"] << endl;
|
||||
}
|
||||
|
||||
if (args.found("transform"))
|
||||
if (args.found("create"))
|
||||
{
|
||||
Info<< nl << "Test List::createList functionality" << nl;
|
||||
Info<< nl << "Test ListOps::create functionality" << nl;
|
||||
|
||||
const auto labels = identity(15);
|
||||
Info<< "labels: " << flatOutput(labels) << endl;
|
||||
|
||||
{
|
||||
auto scalars = List<scalar>::createList
|
||||
auto scalars = ListOps::create<scalar>
|
||||
(
|
||||
labels,
|
||||
[](const label& val){ return scalar(1.5*val); }
|
||||
@ -379,7 +383,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
{
|
||||
auto vectors = List<vector>::createList
|
||||
auto vectors = ListOps::create<vector>
|
||||
(
|
||||
labels,
|
||||
[](const label& val){ return vector(1.2*val, -1.2*val, 0); }
|
||||
@ -388,7 +392,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
{
|
||||
auto longs = List<long>::createList
|
||||
auto longs = ListOps::create<long>
|
||||
(
|
||||
labels,
|
||||
[](const label& val){ return val; }
|
||||
@ -396,7 +400,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "longs: " << flatOutput(longs) << endl;
|
||||
}
|
||||
{
|
||||
auto negs = List<label>::createList
|
||||
auto negs = ListOps::create<label>
|
||||
(
|
||||
labels,
|
||||
std::negate<label>()
|
||||
@ -405,7 +409,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
{
|
||||
auto scalars = List<scalar>::createList
|
||||
auto scalars = ListOps::create<scalar>
|
||||
(
|
||||
labelRange::null.cbegin(),
|
||||
labelRange::identity(15).cend(),
|
||||
@ -417,9 +421,9 @@ int main(int argc, char *argv[])
|
||||
#if WM_LABEL_SIZE == 32
|
||||
{
|
||||
List<int64_t> input(10);
|
||||
std::iota(input.begin(), input.end(), 0);
|
||||
std::iota(input.begin(), input.end(), 50);
|
||||
|
||||
auto output = List<label>::createList
|
||||
auto output = ListOps::create<label>
|
||||
(
|
||||
input,
|
||||
toLabel<int64_t>()
|
||||
@ -429,9 +433,9 @@ int main(int argc, char *argv[])
|
||||
#elif WM_LABEL_SIZE == 64
|
||||
{
|
||||
List<int32_t> input(10);
|
||||
std::iota(input.begin(), input.end(), 0);
|
||||
std::iota(input.begin(), input.end(), 50);
|
||||
|
||||
auto output = List<label>::createList
|
||||
auto output = ListOps::create<label>
|
||||
(
|
||||
input,
|
||||
toLabel<int32_t>()
|
||||
@ -439,6 +443,141 @@ int main(int argc, char *argv[])
|
||||
Info<< "label (from int32): " << flatOutput(output) << endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
labelHashSet locations{ -15, 5, 10, 15, 25, 35 };
|
||||
Info<< nl << "Test for createWithValue with locations :"
|
||||
<< flatOutput(locations.sortedToc()) << nl;
|
||||
|
||||
{
|
||||
auto output = ListOps::createWithValue<label>
|
||||
(
|
||||
30,
|
||||
locations.toc(), // Any order
|
||||
100,
|
||||
-1 // default value
|
||||
);
|
||||
Info<< "with labelUList: " << flatOutput(output)
|
||||
<< " selector: " << flatOutput(locations.sortedToc()) << nl;
|
||||
}
|
||||
|
||||
{
|
||||
auto output = ListOps::createWithValue<label>
|
||||
(
|
||||
30,
|
||||
locations,
|
||||
100,
|
||||
-1 // default value
|
||||
);
|
||||
Info<< "with labelHashSet: " << flatOutput(output)
|
||||
<< " selector: " << flatOutput(locations) << nl;
|
||||
}
|
||||
|
||||
{
|
||||
PackedBoolList select = HashSetOps::bitset(locations);
|
||||
auto output = ListOps::createWithValue<label>
|
||||
(
|
||||
30,
|
||||
select,
|
||||
100,
|
||||
-1 // default value
|
||||
);
|
||||
Info<< "with PackedBoolList: " << flatOutput(output)
|
||||
<< " selector: " << flatOutput(select.used()) << nl;
|
||||
}
|
||||
|
||||
{
|
||||
List<bool> select = HashSetOps::bools(locations);
|
||||
|
||||
auto output = ListOps::createWithValue<label>
|
||||
(
|
||||
30,
|
||||
select,
|
||||
100,
|
||||
-1 // default value
|
||||
);
|
||||
Info<< "with boolList: " << flatOutput(output)
|
||||
<< " selector: " << flatOutput(select) << nl;
|
||||
}
|
||||
|
||||
// Repeat with a shorter selector
|
||||
locations = { -15, 5, 10 };
|
||||
|
||||
{
|
||||
auto output = ListOps::createWithValue<label>
|
||||
(
|
||||
30,
|
||||
locations,
|
||||
100,
|
||||
-1 // default value
|
||||
);
|
||||
Info<< "with labelHashSet: " << flatOutput(output)
|
||||
<< " selector: " << flatOutput(locations) << nl;
|
||||
}
|
||||
|
||||
{
|
||||
PackedBoolList select = HashSetOps::bitset(locations);
|
||||
auto output = ListOps::createWithValue<label>
|
||||
(
|
||||
30,
|
||||
select,
|
||||
100,
|
||||
-1 // default value
|
||||
);
|
||||
Info<< "with PackedBoolList: " << flatOutput(output)
|
||||
<< " selector: " << flatOutput(HashSetOps::used(select))
|
||||
<< nl;
|
||||
}
|
||||
|
||||
{
|
||||
List<bool> select = HashSetOps::bools(locations);
|
||||
|
||||
auto output = ListOps::createWithValue<label>
|
||||
(
|
||||
30,
|
||||
select,
|
||||
100,
|
||||
-1 // default value
|
||||
);
|
||||
Info<< "with boolList: " << flatOutput(output)
|
||||
<< " selector: " << flatOutput(HashSetOps::used(select))
|
||||
<< nl;
|
||||
}
|
||||
}
|
||||
|
||||
if (args.found("ListList"))
|
||||
{
|
||||
{
|
||||
labelListList listlist(5, identity(5));
|
||||
Info<<"list-list with length/val:" << listlist << nl;
|
||||
}
|
||||
|
||||
{
|
||||
labelListList listlist(one(), identity(5));
|
||||
Info<<"list-list 1/val:" << listlist << nl;
|
||||
}
|
||||
|
||||
{
|
||||
labelList content = identity(5);
|
||||
|
||||
labelListList listlist(one(), content);
|
||||
Info<<"list-list 1/copy val:" << listlist
|
||||
<<" - from " << content << nl;
|
||||
}
|
||||
|
||||
{
|
||||
labelList content = identity(5);
|
||||
|
||||
labelListList listlist(one(), std::move(content));
|
||||
Info<<"list-list 1/move val:" << listlist
|
||||
<<" - from " << content << nl;
|
||||
}
|
||||
|
||||
{
|
||||
labelListList listlist(one(), Zero);
|
||||
Info<<"list-list 1/move val:" << listlist
|
||||
<< nl;
|
||||
}
|
||||
}
|
||||
|
||||
if (args.readIfPresent<scalar>("float", xxx))
|
||||
|
||||
@ -129,7 +129,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "transfer contents to a List or IListStream" << nl;
|
||||
|
||||
IListStream ibuf(obuf.xfer());
|
||||
IListStream ibuf;
|
||||
// Reclaim data storage from OListStream -> IListStream
|
||||
{
|
||||
List<char> data;
|
||||
obuf.swap(data);
|
||||
ibuf.swap(data);
|
||||
}
|
||||
|
||||
Info<<"original:";
|
||||
printInfo(obuf);
|
||||
@ -141,6 +147,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Create from other storage types
|
||||
|
||||
List<char> written;
|
||||
Info<< nl;
|
||||
{
|
||||
Info<<"create std::move(List)" << endl;
|
||||
@ -163,35 +170,9 @@ int main(int argc, char *argv[])
|
||||
toString(Info, list) << endl;
|
||||
|
||||
printInfo(buf1);
|
||||
}
|
||||
|
||||
Info<< nl;
|
||||
|
||||
List<char> written;
|
||||
{
|
||||
Info<<"create List.xfer()" << endl;
|
||||
List<char> list(16, 'B');
|
||||
|
||||
Info<<"input:";
|
||||
toString(Info, list) << endl;
|
||||
|
||||
OListStream buf1(list.xfer());
|
||||
for (label i = 0; i < 26; ++i)
|
||||
{
|
||||
buf1 << char('A' + i);
|
||||
}
|
||||
for (label i = 0; i < 26; ++i)
|
||||
{
|
||||
buf1 << char('a' +i);
|
||||
}
|
||||
|
||||
Info<<"orig:";
|
||||
toString(Info, list) << endl;
|
||||
|
||||
printInfo(buf1);
|
||||
|
||||
// Move back to written
|
||||
written = buf1.xfer();
|
||||
buf1.swap(written);
|
||||
|
||||
printInfo(buf1);
|
||||
}
|
||||
|
||||
@ -251,13 +251,13 @@ int main(int argc, char *argv[])
|
||||
Info<< "begin():";
|
||||
iter.printInfo(Info) << "\n";
|
||||
|
||||
Info<< "iterator:" << iter() << "\n";
|
||||
iter() = 5;
|
||||
Info<< "iterator:" << *iter << "\n";
|
||||
*iter = 5;
|
||||
iter.printInfo(Info);
|
||||
list1.printInfo(Info, true);
|
||||
|
||||
iter = list1[31];
|
||||
Info<< "iterator:" << iter() << "\n";
|
||||
Info<< "iterator:" << *iter << "\n";
|
||||
iter.printInfo(Info);
|
||||
|
||||
|
||||
|
||||
@ -229,7 +229,7 @@ int main(int argc, char *argv[])
|
||||
sum = 0;
|
||||
for (label iter = 0; iter < nIters; ++iter)
|
||||
{
|
||||
forAllIter(PackedBoolList, packed, it)
|
||||
forAllIters(packed, it)
|
||||
{
|
||||
sum += it;
|
||||
}
|
||||
@ -244,9 +244,9 @@ int main(int argc, char *argv[])
|
||||
sum = 0;
|
||||
for (label iter = 0; iter < nIters; ++iter)
|
||||
{
|
||||
forAllConstIter(PackedBoolList, packed, cit)
|
||||
forAllConstIters(packed, cit)
|
||||
{
|
||||
sum += cit();
|
||||
sum += *cit;
|
||||
}
|
||||
}
|
||||
std::cout
|
||||
@ -370,9 +370,9 @@ int main(int argc, char *argv[])
|
||||
// Write packed
|
||||
for (label iter = 0; iter < nIters; ++iter)
|
||||
{
|
||||
forAllIter(PackedBoolList, packed, it)
|
||||
forAllIters(packed, it)
|
||||
{
|
||||
it() = 1;
|
||||
*it = 1;
|
||||
}
|
||||
}
|
||||
Info<< "Writing packed using iterator:" << timer.cpuTimeIncrement()
|
||||
|
||||
@ -29,9 +29,12 @@ Description
|
||||
|
||||
#include "uLabel.H"
|
||||
#include "boolList.H"
|
||||
#include "DynamicList.H"
|
||||
#include "IOstreams.H"
|
||||
#include "PackedBoolList.H"
|
||||
#include "ITstream.H"
|
||||
#include "StringStream.H"
|
||||
#include "FlatOutput.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -135,8 +138,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
PackedBoolList list4
|
||||
(
|
||||
IStringStream
|
||||
ITstream
|
||||
(
|
||||
"input",
|
||||
"(1 n 1 n 1 n 1 1 off 0 0 f f 0 y yes y true y false on t)"
|
||||
)()
|
||||
);
|
||||
@ -199,6 +203,18 @@ int main(int argc, char *argv[])
|
||||
|
||||
list4.writeEntry("PackedBoolList", Info);
|
||||
|
||||
// Construct from labelUList, labelUIndList
|
||||
{
|
||||
DynamicList<label> indices({10, 50, 300});
|
||||
|
||||
Info<< "set: " << flatOutput(indices) << endl;
|
||||
|
||||
PackedBoolList bools1(indices);
|
||||
|
||||
Info<< "used: " << bools1.size() << " "
|
||||
<< flatOutput(bools1.used()) << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@ public:
|
||||
|
||||
autoPtr<Scalar> clone() const
|
||||
{
|
||||
return autoPtr<Scalar>(new Scalar(data_));
|
||||
return autoPtr<Scalar>::New(data_);
|
||||
}
|
||||
|
||||
friend Ostream& operator<<(Ostream& os, const Scalar& val)
|
||||
@ -147,8 +147,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(std::move(list1));
|
||||
Info<<"Move constructed" << endl;
|
||||
|
||||
Info<<"list1: " << list1 << nl
|
||||
<<"list2: " << list2 << nl
|
||||
|
||||
3
applications/test/autoPtr/Make/files
Normal file
3
applications/test/autoPtr/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-autoPtr.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-autoPtr
|
||||
5
applications/test/autoPtr/Make/options
Normal file
5
applications/test/autoPtr/Make/options
Normal file
@ -0,0 +1,5 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lthermophysicalProperties
|
||||
219
applications/test/autoPtr/Test-autoPtr.C
Normal file
219
applications/test/autoPtr/Test-autoPtr.C
Normal file
@ -0,0 +1,219 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "autoPtr.H"
|
||||
#include "labelList.H"
|
||||
#include "ListOps.H"
|
||||
#include "IOstreams.H"
|
||||
#include "Switch.H"
|
||||
|
||||
#include "C7H16.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
|
||||
// An example of bad use, since our autoPtr is too generous when being passed
|
||||
// around
|
||||
void testTransfer1(autoPtr<labelList> ap)
|
||||
{
|
||||
// Passed in copy, so automatically removes content
|
||||
// Transfer would be nice, but not actually needed
|
||||
|
||||
Info<< "recv " << Switch(ap.valid()).c_str() << nl;
|
||||
}
|
||||
|
||||
|
||||
// An example of good use. We are allowed to manage the memory (or not)
|
||||
// and not automatically start losing things.
|
||||
void testTransfer2(autoPtr<labelList>&& ap)
|
||||
{
|
||||
// As rvalue, so this time we actually get to manage content
|
||||
Info<< "recv " << Switch(ap.valid()).c_str() << nl;
|
||||
}
|
||||
|
||||
|
||||
// Constructor from literal nullptr is implicit
|
||||
template<class T>
|
||||
autoPtr<T> testNullReturn1()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
// Constructor from raw pointer is explicit
|
||||
template<class T>
|
||||
autoPtr<T> testNullReturn2()
|
||||
{
|
||||
T* p = new T;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
{
|
||||
auto list = autoPtr<labelList>::New(10, label(-1));
|
||||
|
||||
Info<<"create: " << list() << nl;
|
||||
|
||||
Info<<"create: " << autoPtr<labelList>::New(10, label(-1))()
|
||||
<< nl << nl;
|
||||
}
|
||||
|
||||
// Confirm that forwarding with move construct actually works as expected
|
||||
{
|
||||
auto source = identity(8);
|
||||
Info<<"move construct from "
|
||||
<< flatOutput(source) << " @ " << long(source.cdata())
|
||||
<< nl << nl;
|
||||
|
||||
auto list = autoPtr<labelList>::New(std::move(source));
|
||||
|
||||
Info<<"created: " << flatOutput(*list) << " @ " << long(list->cdata())
|
||||
<< nl << nl;
|
||||
|
||||
Info<<"orig: "
|
||||
<< flatOutput(source) << " @ " << long(source.cdata())
|
||||
<< nl << nl;
|
||||
}
|
||||
|
||||
// Explicit construct Base from Derived
|
||||
{
|
||||
autoPtr<liquidProperties> liqProp
|
||||
(
|
||||
autoPtr<C7H16>::New()
|
||||
);
|
||||
|
||||
Info<<"liq 1: " << liqProp() << nl << nl;
|
||||
}
|
||||
|
||||
// Construct Base from Derived
|
||||
{
|
||||
autoPtr<liquidProperties> liqProp =
|
||||
autoPtr<liquidProperties>::NewFrom<C7H16>();
|
||||
|
||||
Info<<"liq 2: " << liqProp() << nl << nl;
|
||||
}
|
||||
|
||||
// Construct Base from Derived
|
||||
{
|
||||
const autoPtr<liquidProperties> liqProp(autoPtr<C7H16>::New());
|
||||
|
||||
Info<<"liq: " << liqProp() << nl << nl;
|
||||
Info<<"liq-type: " << liqProp->type() << nl << nl;
|
||||
Info<<"type: " << typeid(liqProp.get()).name() << nl;
|
||||
}
|
||||
|
||||
// Memory transfer
|
||||
{
|
||||
Info<< nl << nl;
|
||||
|
||||
auto list = autoPtr<labelList>::New(identity(8));
|
||||
Info<<"forward to function from "
|
||||
<< flatOutput(*list) << " @ " << long(list->cdata())
|
||||
<< nl << nl;
|
||||
|
||||
testTransfer2(std::move(list));
|
||||
|
||||
Info<<"now have valid=" << Switch(list.valid()).c_str();
|
||||
|
||||
if (list.valid())
|
||||
{
|
||||
Info<< nl
|
||||
<< flatOutput(*list) << " @ " << long(list->cdata())
|
||||
<< nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< nl;
|
||||
}
|
||||
}
|
||||
|
||||
// Memory transfer
|
||||
{
|
||||
Info<< nl << nl;
|
||||
|
||||
testTransfer2(autoPtr<labelList>::New(identity(8)));
|
||||
}
|
||||
|
||||
// Memory transfer
|
||||
{
|
||||
Info<< nl << nl;
|
||||
|
||||
auto list = autoPtr<labelList>::New(identity(8));
|
||||
Info<<"forward to function from "
|
||||
<< flatOutput(*list) << " @ " << long(list->cdata())
|
||||
<< nl << nl;
|
||||
|
||||
testTransfer2(std::move(list));
|
||||
|
||||
Info<<"now have valid=" << Switch(list.valid()).c_str();
|
||||
|
||||
if (list.valid())
|
||||
{
|
||||
Info<< nl
|
||||
<< flatOutput(*list) << " @ " << long(list->cdata())
|
||||
<< nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< nl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Memory transfer
|
||||
{
|
||||
auto ptr1 = autoPtr<labelList>::New();
|
||||
auto ptr2 = autoPtr<labelList>::New();
|
||||
|
||||
Info<<"ptr valid: " << ptr1.valid() << nl;
|
||||
|
||||
// Refuses to compile (good!): ptr1 = new labelList(10);
|
||||
|
||||
// Does compile (good!): ptr1 = nullptr;
|
||||
|
||||
ptr1.reset(std::move(ptr2));
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
// Good this work:
|
||||
autoPtr<labelList> ptr1 = testNullReturn1<labelList>();
|
||||
|
||||
// Good this does not compile:
|
||||
// autoPtr<labelList> ptr2 = testNullReturn2<labelList>();
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -71,7 +71,7 @@ int main(int argc, char *argv[])
|
||||
<< "keys: " << dict1.keys() << nl
|
||||
<< "patterns: " << dict1.keys(true) << endl;
|
||||
|
||||
dictionary dict2(dict1.xfer());
|
||||
dictionary dict2(std::move(dict1));
|
||||
|
||||
Info<< "dict1.toc(): " << dict1.name() << " " << dict1.toc() << nl
|
||||
<< "dict2.toc(): " << dict2.name() << " " << dict2.toc()
|
||||
|
||||
@ -202,7 +202,7 @@ int main(int argc, char *argv[])
|
||||
autoPtr<mapPolyMesh> morphMap = meshMod.changeMesh(mesh, inflate);
|
||||
|
||||
Info<< "Mapping fields" << nl << endl;
|
||||
mesh.updateMesh(morphMap);
|
||||
mesh.updateMesh(morphMap());
|
||||
|
||||
// Move mesh (since morphing does not do this)
|
||||
if (morphMap().hasMotionPoints())
|
||||
@ -212,7 +212,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// Update numbering of cells/vertices.
|
||||
faceRemover.updateMesh(morphMap);
|
||||
faceRemover.updateMesh(morphMap());
|
||||
|
||||
|
||||
Info<< "Writing fields" << nl << endl;
|
||||
|
||||
@ -276,7 +276,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Update fields
|
||||
Info<< nl << "-- mapping mesh data" << endl;
|
||||
mesh.updateMesh(map);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// Inflate mesh
|
||||
if (map().hasMotionPoints())
|
||||
@ -287,7 +287,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Update numbering of cells/vertices.
|
||||
Info<< nl << "-- mapping hexRef8 data" << endl;
|
||||
meshCutter.updateMesh(map);
|
||||
meshCutter.updateMesh(map());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -51,19 +51,20 @@ int main(int argc, char *argv[])
|
||||
const scalar instanceValue(0.005);
|
||||
|
||||
|
||||
IOobject io
|
||||
IOmapDistributePolyMesh map
|
||||
(
|
||||
"procAddressing",
|
||||
instance,
|
||||
fvMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
IOobject
|
||||
(
|
||||
"procAddressing",
|
||||
instance,
|
||||
fvMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
IOmapDistributePolyMesh map(io);
|
||||
|
||||
{
|
||||
// Load the instance mesh
|
||||
runTime.setTime(instanceValue, 0);
|
||||
@ -112,7 +113,6 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
const mapDistribute& cellMap = map.cellMap();
|
||||
pointField cc(mesh.cellCentres());
|
||||
|
||||
@ -91,7 +91,7 @@ int main(int argc, char *argv[])
|
||||
runTime,
|
||||
Foam::IOobject::NO_READ
|
||||
),
|
||||
Xfer<pointField>(points),
|
||||
std::move(points),
|
||||
shapes,
|
||||
boundaryFaces,
|
||||
boundaryPatchNames,
|
||||
|
||||
@ -111,7 +111,7 @@ void testMapDistribute()
|
||||
}
|
||||
|
||||
// Construct distribute map (destructively)
|
||||
mapDistribute map(constructSize, sendMap.xfer(), recvMap.xfer());
|
||||
mapDistribute map(constructSize, std::move(sendMap), std::move(recvMap));
|
||||
|
||||
// Distribute complexData
|
||||
map.distribute(complexData);
|
||||
|
||||
@ -246,15 +246,16 @@ int main(int argc, char *argv[])
|
||||
writeFaceFaces(localPoints, localFaces, faceFaces);
|
||||
}
|
||||
|
||||
// Test construction from Xfer
|
||||
// Move construct
|
||||
{
|
||||
faceList patchFaces = patch;
|
||||
pointField allPoints = patch.points();
|
||||
|
||||
PrimitivePatch<face, List, pointField, point> storedPatch
|
||||
(
|
||||
patchFaces.xfer(),
|
||||
allPoints.xfer()
|
||||
patchFaces,
|
||||
allPoints,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -413,9 +413,9 @@ int main(int argc, char *argv[])
|
||||
surf.writeStats(Info);
|
||||
Info<< endl;
|
||||
|
||||
ModifiableMeshedSurface<face> tsurf(surf.xfer());
|
||||
// ModifiableMeshedSurface<face> tsurf;
|
||||
// tsurf.reset(surf.xfer());
|
||||
ModifiableMeshedSurface<face> tsurf(std::move(surf));
|
||||
// ModifiableMeshedSurface<face> xtsurf;
|
||||
// xtsurf.transfer(surf);
|
||||
|
||||
Info<< "in-progress" << nl;
|
||||
surf.writeStats(Info);
|
||||
@ -515,7 +515,7 @@ int main(int argc, char *argv[])
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
surf.xfer()
|
||||
std::move(surf)
|
||||
);
|
||||
|
||||
Info<< "writing surfMesh as well: " << surfOut.objectPath() << endl;
|
||||
@ -546,7 +546,6 @@ int main(int argc, char *argv[])
|
||||
surfOut.setInstance(runTime.timeName());
|
||||
|
||||
|
||||
|
||||
Info<< "writing surfMesh again well: " << surfOut.objectPath()
|
||||
<< endl;
|
||||
surfOut.write();
|
||||
|
||||
3
applications/test/tmp/Make/files
Normal file
3
applications/test/tmp/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-tmp.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-tmp
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -22,10 +22,10 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
tmpFieldTest
|
||||
Test-tmp
|
||||
|
||||
Description
|
||||
Tests for possible memory leaks in the tmp<Field> algebra.
|
||||
Tests for possible memory leaks in the tmp (and tmp<Field> algebra).
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -33,19 +33,50 @@ Description
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
struct myScalarField : public scalarField
|
||||
{
|
||||
using scalarField::scalarField;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main()
|
||||
{
|
||||
scalarField f1(1000000, 1.0), f2(1000000, 2.0), f3(1000000, 3.0);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
f1 = f2 + f3 + f2 + f3;
|
||||
scalarField f1(1000000, 1.0), f2(1000000, 2.0), f3(1000000, 3.0);
|
||||
|
||||
for (int iter=0; iter < 50; ++iter)
|
||||
{
|
||||
f1 = f2 + f3 + f2 + f3;
|
||||
}
|
||||
|
||||
Info<<"f1 = " << f1 << nl;
|
||||
}
|
||||
|
||||
Info<< "end" << endl;
|
||||
{
|
||||
tmp<scalarField> tfld1 = tmp<scalarField>::New(20, Zero);
|
||||
|
||||
Info<< "tmp refCount = " << tfld1->count() << nl;
|
||||
if (tfld1.valid())
|
||||
{
|
||||
Info<<"tmp: " << tfld1() << nl;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
tmp<scalarField> tfld2 =
|
||||
tmp<scalarField>::NewFrom<myScalarField>(20, Zero);
|
||||
|
||||
Info<< "tmp refCount = " << tfld2->count() << nl;
|
||||
if (tfld2.valid())
|
||||
{
|
||||
Info<<"tmp: " << tfld2() << nl;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "\nEnd" << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
Test-tmpField.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-tmpField
|
||||
@ -1,3 +0,0 @@
|
||||
Test-xfer1.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-xfer1
|
||||
@ -1,233 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "OSspecific.H"
|
||||
|
||||
#include "IOstreams.H"
|
||||
#include "labelList.H"
|
||||
#include "DynamicList.H"
|
||||
#include "face.H"
|
||||
#include "pointField.H"
|
||||
#include "DynamicField.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
|
||||
template<class Type>
|
||||
void printInfo(const Xfer<Type>& xf)
|
||||
{
|
||||
Info<<" address:" << long(xf.get()) << nl
|
||||
<<" isNull = " << isNull(xf) << nl
|
||||
<<" notNull = " << notNull(xf) << nl
|
||||
<<" valid() = " << xf.valid() << nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
labelList lstA(10);
|
||||
labelList lstC
|
||||
{
|
||||
1, 2, 3, 4
|
||||
};
|
||||
|
||||
forAll(lstA, i)
|
||||
{
|
||||
lstA[i] = 5 - i;
|
||||
}
|
||||
|
||||
// Information about null-object
|
||||
|
||||
Info<<"nullObject:" << nl;
|
||||
printInfo(Xfer<labelList>::null());
|
||||
{
|
||||
// This probably needs more work...
|
||||
Xfer<labelList> xf = Xfer<labelList>::null();
|
||||
|
||||
Info<<"copy of nullObject:" << nl;
|
||||
printInfo(xf);
|
||||
}
|
||||
|
||||
Info<< "lstA: " << lstA << nl
|
||||
<< "lstC: " << lstC << nl;
|
||||
|
||||
Xfer<labelList> xA = xferMove(lstA);
|
||||
Xfer<labelList> xB;
|
||||
|
||||
labelList lstB( xA );
|
||||
|
||||
Info<< "xA: " << xA() << nl
|
||||
<< "xB: " << xB() << nl
|
||||
<< "lstA: " << lstA << nl
|
||||
<< "lstB: " << lstB << nl
|
||||
<< "lstC: " << lstC << nl;
|
||||
|
||||
// Now illegal: xA = lstB;
|
||||
|
||||
xA->transfer(lstB);
|
||||
|
||||
Info<< "xA: " << xA() << nl
|
||||
<< "xB: " << xB() << nl
|
||||
<< "lstA: " << lstA << nl
|
||||
<< "lstB: " << lstB << nl
|
||||
<< "lstC: " << lstC << nl;
|
||||
|
||||
xB = xA;
|
||||
|
||||
// Construct with forwarding. For this example, truly ugly.
|
||||
Xfer<labelList> xFwdA =
|
||||
Xfer<labelList>::New
|
||||
(
|
||||
std::initializer_list<label>
|
||||
{
|
||||
1, 2, 10, 20, 15, 24, 200
|
||||
}
|
||||
);
|
||||
|
||||
Xfer<labelList> xFwdB = Xfer<labelList>::New(label(8), 123);
|
||||
Xfer<labelList> xFwdC = Xfer<labelList>::New();
|
||||
|
||||
Info<< nl
|
||||
<< "Constructed with forwarding: " << nl
|
||||
<< *xFwdA << nl
|
||||
<< *xFwdB << nl
|
||||
<< *xFwdC << nl
|
||||
<< nl;
|
||||
|
||||
|
||||
labelList lstD(xferCopy(lstC));
|
||||
labelList lstE(xferMove(lstC));
|
||||
|
||||
// this must be empty
|
||||
labelList lstF = xferCopy(lstC);
|
||||
|
||||
Info<< "xA: " << xA() << nl
|
||||
<< "xB: " << xB() << nl
|
||||
<< "lstA: " << lstA << nl
|
||||
<< "lstB: " << lstB << nl
|
||||
<< "lstC: " << lstC << nl
|
||||
<< "lstD: " << lstD << nl
|
||||
<< "lstE: " << lstE << nl
|
||||
<< "lstF: " << lstF << nl;
|
||||
|
||||
Info<< "xB[" << xB->size() << "]\n";
|
||||
|
||||
// clear the underlying List
|
||||
xB->clear();
|
||||
|
||||
Info<< "xB[" << xB->size() << "]\n";
|
||||
|
||||
DynamicList<label> dl;
|
||||
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 << nl;
|
||||
Info<< "f1: " << f1 << nl;
|
||||
Info<< "f2: " << f2 << nl;
|
||||
|
||||
// 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 << nl;
|
||||
Info<< "f3: " << f3 << nl;
|
||||
|
||||
Info<<"\nflip faces:" << nl;
|
||||
f1.flip();
|
||||
f3.flip();
|
||||
Info<< "f1: " << f1 << nl;
|
||||
Info<< "f3: " << f3 << nl;
|
||||
|
||||
|
||||
{
|
||||
Info<<"\nTest xfer with fields:" << nl;
|
||||
List<point> list1
|
||||
{
|
||||
{ 0, 1, 2 },
|
||||
{ 3, 4, 5 },
|
||||
{ 6, 7, 8 },
|
||||
{ 9, 10, 11 },
|
||||
};
|
||||
|
||||
// Field from Xfer<List>
|
||||
pointField field1(list1.xfer());
|
||||
Info<<nl
|
||||
<< "xfer construct from List" << nl
|
||||
<<"input (list) = " << list1 << nl
|
||||
<<"output (field) = " << field1 << nl;
|
||||
|
||||
|
||||
// Field from Xfer<List> ... again
|
||||
pointField field2(field1.xfer());
|
||||
Info<<nl
|
||||
<<"xfer construct from Field (as List): " << nl
|
||||
<<"input (field) = " << field1 << nl
|
||||
<<"output (field) = " << field2 << nl;
|
||||
|
||||
|
||||
// Field from Xfer<Field>
|
||||
pointField field3(xferMove(field2));
|
||||
Info<<nl
|
||||
<<"xfer construct from Field (as Field): " << nl
|
||||
<<"input (field) = " << field2 << nl
|
||||
<<"output (field) = " << field3 << nl;
|
||||
|
||||
|
||||
// Field from Xfer<Field> .. again
|
||||
pointField field4(xferCopy(field3));
|
||||
Info<<nl
|
||||
<<"xfer copy construct from Field (as Field): " << nl
|
||||
<<"input (field) = " << field3 << nl
|
||||
<<"output (field) = " << field4 << nl;
|
||||
|
||||
|
||||
DynamicField<point> dyfield1(xferCopy(field4));
|
||||
Info<<nl
|
||||
<<"xfer copy construct from Field (as Field): " << nl
|
||||
<<"input (field) = " << field4 << nl
|
||||
<<"output (dyn-field) = " << dyfield1 << nl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1155,7 +1155,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// Change the mesh. Change points directly (no inflation).
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(subsetter.subMesh(), false);
|
||||
autoPtr<mapPolyMesh> mapPtr =
|
||||
meshMod.changeMesh(subsetter.subMesh(), false);
|
||||
mapPolyMesh& map = *mapPtr;
|
||||
|
||||
// Update fields
|
||||
subsetter.subMesh().updateMesh(map);
|
||||
@ -1231,9 +1233,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// Move mesh (since morphing might not do this)
|
||||
if (map().hasMotionPoints())
|
||||
if (map.hasMotionPoints())
|
||||
{
|
||||
subsetter.subMesh().movePoints(map().preMotionPoints());
|
||||
subsetter.subMesh().movePoints(map.preMotionPoints());
|
||||
}
|
||||
|
||||
Info<< "Writing mesh with split blockedFaces to time " << runTime.value()
|
||||
|
||||
@ -186,7 +186,7 @@ int main(int argc, char *argv[])
|
||||
polyMeshFilter::copySets(newMesh(), mesh);
|
||||
}
|
||||
|
||||
pointPriority = meshFilter.pointPriority();
|
||||
pointPriority = *(meshFilter.pointPriority());
|
||||
}
|
||||
|
||||
if (collapseFaceSet)
|
||||
@ -203,14 +203,14 @@ int main(int argc, char *argv[])
|
||||
// from the previous edge filtering to use as a stopping criterion.
|
||||
meshFilter.filter(indirectPatchFaces);
|
||||
{
|
||||
polyTopoChange meshMod(newMesh);
|
||||
polyTopoChange meshMod(newMesh());
|
||||
|
||||
meshMod.changeMesh(mesh, false);
|
||||
|
||||
polyMeshFilter::copySets(newMesh(), mesh);
|
||||
}
|
||||
|
||||
pointPriority = meshFilter.pointPriority();
|
||||
pointPriority = *(meshFilter.pointPriority());
|
||||
}
|
||||
|
||||
if (collapseFaces)
|
||||
@ -227,14 +227,14 @@ int main(int argc, char *argv[])
|
||||
// from the previous edge filtering to use as a stopping criterion.
|
||||
meshFilter.filter(nBadFaces);
|
||||
{
|
||||
polyTopoChange meshMod(newMesh);
|
||||
polyTopoChange meshMod(newMesh());
|
||||
|
||||
meshMod.changeMesh(mesh, false);
|
||||
|
||||
polyMeshFilter::copySets(newMesh(), mesh);
|
||||
}
|
||||
|
||||
pointPriority = meshFilter.pointPriority();
|
||||
pointPriority = *(meshFilter.pointPriority());
|
||||
}
|
||||
|
||||
// Write resulting mesh
|
||||
|
||||
@ -113,7 +113,7 @@ label mergePatchFaces
|
||||
map = meshMod.changeMesh(mesh, false, true);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// Move mesh (since morphing does not do this)
|
||||
if (map().hasMotionPoints())
|
||||
@ -269,7 +269,7 @@ label mergePatchFaces
|
||||
map = meshMod.changeMesh(mesh, false, true);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// Move mesh (since morphing does not do this)
|
||||
if (map().hasMotionPoints())
|
||||
@ -322,7 +322,7 @@ label mergeEdges(const scalar minCos, polyMesh& mesh)
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false, true);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// Move mesh (since morphing does not do this)
|
||||
if (map().hasMotionPoints())
|
||||
|
||||
@ -174,10 +174,10 @@ int main(int argc, char *argv[])
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// Update numbering of cells/vertices.
|
||||
meshCutter.updateMesh(map);
|
||||
meshCutter.updateMesh(map());
|
||||
|
||||
// Optionally inflate mesh
|
||||
if (map().hasMotionPoints())
|
||||
|
||||
@ -214,9 +214,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())
|
||||
pointField(mesh.points()), // Could we safely re-use the data?
|
||||
faceList(mesh.faces()),
|
||||
cellList(mesh.cells())
|
||||
);
|
||||
|
||||
// Add the boundary patches
|
||||
|
||||
@ -155,18 +155,18 @@ int main(int argc, char *argv[])
|
||||
meshMod
|
||||
);
|
||||
|
||||
autoPtr<mapPolyMesh> morphMap = meshMod.changeMesh(mesh, false);
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||
|
||||
mesh.updateMesh(morphMap);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// Move mesh (since morphing does not do this)
|
||||
if (morphMap().hasMotionPoints())
|
||||
if (map().hasMotionPoints())
|
||||
{
|
||||
mesh.movePoints(morphMap().preMotionPoints());
|
||||
mesh.movePoints(map().preMotionPoints());
|
||||
}
|
||||
|
||||
// Update numbering of cells/vertices.
|
||||
faceRemover.updateMesh(morphMap);
|
||||
faceRemover.updateMesh(map());
|
||||
|
||||
if (!overwrite)
|
||||
{
|
||||
|
||||
@ -416,20 +416,14 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
|
||||
// Surface
|
||||
autoPtr<triSurface> surf(nullptr);
|
||||
// Search engine on surface.
|
||||
autoPtr<triSurfaceSearch> querySurf(nullptr);
|
||||
|
||||
if (useSurface)
|
||||
{
|
||||
surf.reset(new triSurface(surfName));
|
||||
triSurface surf(surfName);
|
||||
|
||||
// Dump some stats
|
||||
surf().writeStats(Info);
|
||||
surf.writeStats(Info);
|
||||
|
||||
// Search engine on surface.
|
||||
querySurf.reset(new triSurfaceSearch(surf));
|
||||
triSurfaceSearch querySurf(surf);
|
||||
|
||||
// Set cellType[celli] according to relation to surface
|
||||
cutBySurface
|
||||
|
||||
@ -446,27 +446,23 @@ int main(int argc, char *argv[])
|
||||
const word defaultFacesName = "defaultFaces";
|
||||
word defaultFacesType = emptyPolyPatch::typeName;
|
||||
|
||||
// Create dummy mesh just to find out what are internal/external
|
||||
// faces
|
||||
autoPtr<polyMesh> dummyMesh
|
||||
// Create dummy mesh just to find out what are internal/external faces
|
||||
auto dummyMesh = autoPtr<polyMesh>::New
|
||||
(
|
||||
new polyMesh
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"dummyMesh",
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferCopy(points),
|
||||
cellShapes,
|
||||
faceListList(0),
|
||||
wordList(0),
|
||||
wordList(0),
|
||||
defaultFacesName,
|
||||
defaultFacesType,
|
||||
wordList(0)
|
||||
)
|
||||
"dummyMesh",
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
pointField(points), // copy
|
||||
cellShapes,
|
||||
faceListList(),
|
||||
wordList(),
|
||||
wordList(),
|
||||
defaultFacesName,
|
||||
defaultFacesType,
|
||||
wordList()
|
||||
);
|
||||
|
||||
|
||||
@ -605,7 +601,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
std::move(points),
|
||||
cellShapes,
|
||||
patchFaces,
|
||||
patchNames,
|
||||
@ -615,7 +611,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
|
||||
if (cellTypes.size() > 0 || patchNames.size() > 0)
|
||||
if (cellTypes.size() || patchNames.size())
|
||||
{
|
||||
DynamicList<pointZone*> pz;
|
||||
DynamicList<faceZone*> fz;
|
||||
|
||||
@ -266,7 +266,7 @@ int main(int argc, char *argv[])
|
||||
Info<< nl << "Bounding box size: " << mesh().bounds().span() << nl;
|
||||
|
||||
// check number of regions
|
||||
regionSplit rs(mesh);
|
||||
regionSplit rs(mesh());
|
||||
|
||||
Info<< "Number of regions: " << rs.nRegions();
|
||||
if (rs.nRegions() == 1)
|
||||
@ -281,7 +281,7 @@ int main(int argc, char *argv[])
|
||||
<< "**************************************************" << nl;
|
||||
}
|
||||
Info<< endl;
|
||||
reader.writeMesh(mesh, format);
|
||||
reader.writeMesh(mesh(), format);
|
||||
|
||||
// exportName only has a size when export is in effect
|
||||
if (exportName.size())
|
||||
|
||||
@ -739,7 +739,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
std::move(points),
|
||||
cellShapes,
|
||||
boundary,
|
||||
patchNames,
|
||||
|
||||
@ -945,10 +945,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferCopy(pointField()),
|
||||
xferCopy(faceList()),
|
||||
xferCopy(labelList()),
|
||||
xferCopy(labelList())
|
||||
Zero
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -1175,7 +1175,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
std::move(points),
|
||||
cellShapes,
|
||||
patches,
|
||||
patchNames,
|
||||
|
||||
@ -853,7 +853,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
std::move(points),
|
||||
cells,
|
||||
boundary,
|
||||
patchNames,
|
||||
|
||||
@ -931,7 +931,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
std::move(points),
|
||||
cells,
|
||||
boundaryFaces,
|
||||
boundaryPatchNames,
|
||||
|
||||
@ -1128,17 +1128,13 @@ int main(int argc, char *argv[])
|
||||
<< nl << endl;
|
||||
|
||||
// Create globally numbered surface
|
||||
meshedSurface rawSurface
|
||||
(
|
||||
xferCopy(polyPoints),
|
||||
xferCopyTo<faceList>(boundaryFaces)
|
||||
);
|
||||
meshedSurface rawSurface(polyPoints, boundaryFaces);
|
||||
|
||||
// Write locally numbered surface
|
||||
meshedSurface
|
||||
(
|
||||
xferCopy(rawSurface.localPoints()),
|
||||
xferCopy(rawSurface.localFaces())
|
||||
rawSurface.localPoints(),
|
||||
rawSurface.localFaces()
|
||||
).write(runTime.path()/"boundaryFaces.obj");
|
||||
}
|
||||
|
||||
@ -1171,14 +1167,14 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(polyPoints),
|
||||
std::move(polyPoints),
|
||||
cellVerts,
|
||||
usedPatchFaceVerts, // boundaryFaces,
|
||||
usedPatchNames, // boundaryPatchNames,
|
||||
usedPatchFaceVerts, // boundaryFaces,
|
||||
usedPatchNames, // boundaryPatchNames,
|
||||
wordList(patchNames.size(), polyPatch::typeName), // boundaryPatchTypes,
|
||||
"defaultFaces", // defaultFacesName
|
||||
polyPatch::typeName, // defaultFacesType,
|
||||
wordList(0) // boundaryPatchPhysicalTypes
|
||||
"defaultFaces", // defaultFacesName
|
||||
polyPatch::typeName, // defaultFacesType,
|
||||
wordList() // boundaryPatchPhysicalTypes
|
||||
);
|
||||
|
||||
// Remove files now, to ensure all mesh files written are consistent.
|
||||
|
||||
@ -565,7 +565,7 @@ polyMesh pShapeMesh
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
std::move(points),
|
||||
cellShapes,
|
||||
boundary,
|
||||
patchNames,
|
||||
|
||||
@ -144,14 +144,14 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
std::move(points),
|
||||
cells,
|
||||
faceListList(0),
|
||||
wordList(0),
|
||||
wordList(0),
|
||||
faceListList(),
|
||||
wordList(),
|
||||
wordList(),
|
||||
"defaultFaces",
|
||||
polyPatch::typeName,
|
||||
wordList(0)
|
||||
wordList()
|
||||
);
|
||||
|
||||
// Set the precision of the points data to 10
|
||||
|
||||
@ -303,7 +303,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
std::move(points),
|
||||
cells,
|
||||
patchFaces,
|
||||
patchNames,
|
||||
|
||||
@ -247,7 +247,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(newPoints),
|
||||
std::move(newPoints),
|
||||
cellShapes,
|
||||
boundary,
|
||||
patchNames,
|
||||
|
||||
@ -119,7 +119,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
autoPtr<polyMesh> mesh = reader.mesh(runTime);
|
||||
reader.writeMesh(mesh, format);
|
||||
reader.writeMesh(mesh(), format);
|
||||
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
@ -318,27 +318,24 @@ int main(int argc, char *argv[])
|
||||
// Construct mesh with default boundary only
|
||||
//
|
||||
|
||||
autoPtr<polyMesh> meshPtr
|
||||
auto meshPtr = autoPtr<polyMesh>::New
|
||||
(
|
||||
new polyMesh
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
polyMesh::defaultRegion,
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferCopy(points),
|
||||
cells,
|
||||
faceListList(0),
|
||||
wordList(0), // boundaryPatchNames
|
||||
wordList(0), // boundaryPatchTypes
|
||||
"defaultFaces",
|
||||
polyPatch::typeName,
|
||||
wordList(0)
|
||||
)
|
||||
polyMesh::defaultRegion,
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
pointField(points), // Copy of points
|
||||
cells,
|
||||
faceListList(),
|
||||
wordList(), // boundaryPatchNames
|
||||
wordList(), // boundaryPatchTypes
|
||||
"defaultFaces",
|
||||
polyPatch::typeName,
|
||||
wordList()
|
||||
);
|
||||
const polyMesh& mesh = meshPtr;
|
||||
const polyMesh& mesh = *meshPtr;
|
||||
|
||||
|
||||
if (readFaceFile)
|
||||
@ -531,7 +528,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(points),
|
||||
std::move(points),
|
||||
cells,
|
||||
patchFaces,
|
||||
patchNames,
|
||||
|
||||
@ -68,14 +68,14 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferMove(reader.points()),
|
||||
std::move(reader.points()),
|
||||
reader.cells(),
|
||||
faceListList(0),
|
||||
wordList(0),
|
||||
wordList(0),
|
||||
faceListList(),
|
||||
wordList(),
|
||||
wordList(),
|
||||
"defaultFaces",
|
||||
polyPatch::typeName,
|
||||
wordList(0)
|
||||
wordList()
|
||||
);
|
||||
|
||||
// Set the precision of the points data to 10
|
||||
|
||||
@ -277,7 +277,7 @@ int main(int argc, char *argv[])
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
xferCopy(blocks.points()), // could we re-use space?
|
||||
pointField(blocks.points()), // Copy, could we re-use space?
|
||||
blocks.cells(),
|
||||
blocks.patches(),
|
||||
blocks.patchNames(),
|
||||
|
||||
@ -433,7 +433,7 @@ int main(int argc, char *argv[])
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// Move mesh (since morphing does not do this)
|
||||
if (map().hasMotionPoints())
|
||||
@ -788,7 +788,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
layerExtrude.addedCells
|
||||
(
|
||||
meshFromMesh,
|
||||
*meshFromMesh,
|
||||
layerExtrude.layerFaces()
|
||||
)
|
||||
);
|
||||
@ -937,7 +937,7 @@ int main(int argc, char *argv[])
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// Update stored data
|
||||
updateFaceLabels(map(), frontPatchFaces);
|
||||
@ -1074,7 +1074,7 @@ int main(int argc, char *argv[])
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
mesh.updateMesh(map());
|
||||
|
||||
// Update local data
|
||||
updateCellSet(map(), addedCellsSet);
|
||||
|
||||
@ -63,7 +63,7 @@ class extrudedMesh
|
||||
|
||||
//- Construct and return the extruded mesh points
|
||||
template<class Face, template<class> class FaceList, class PointField>
|
||||
Xfer<pointField> extrudedPoints
|
||||
pointField extrudedPoints
|
||||
(
|
||||
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel&
|
||||
@ -71,7 +71,7 @@ class extrudedMesh
|
||||
|
||||
//- Construct and return the extruded mesh faces
|
||||
template<class Face, template<class> class FaceList, class PointField>
|
||||
Xfer<faceList> extrudedFaces
|
||||
faceList extrudedFaces
|
||||
(
|
||||
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel&
|
||||
@ -79,7 +79,7 @@ class extrudedMesh
|
||||
|
||||
//- Construct and return the extruded mesh cells
|
||||
template<class Face, template<class> class FaceList, class PointField>
|
||||
Xfer<cellList> extrudedCells
|
||||
cellList extrudedCells
|
||||
(
|
||||
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel&
|
||||
@ -87,10 +87,10 @@ class extrudedMesh
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
extrudedMesh(const extrudedMesh&);
|
||||
extrudedMesh(const extrudedMesh&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const extrudedMesh&);
|
||||
void operator=(const extrudedMesh&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -34,7 +34,7 @@ template
|
||||
template<class> class FaceList,
|
||||
class PointField
|
||||
>
|
||||
Foam::Xfer<Foam::pointField> Foam::extrudedMesh::extrudedPoints
|
||||
Foam::pointField Foam::extrudedMesh::extrudedPoints
|
||||
(
|
||||
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel& model
|
||||
@ -47,9 +47,9 @@ Foam::Xfer<Foam::pointField> Foam::extrudedMesh::extrudedPoints
|
||||
|
||||
pointField ePoints((nLayers + 1)*surfacePoints.size());
|
||||
|
||||
for (label layer=0; layer<=nLayers; layer++)
|
||||
for (label layer=0; layer <= nLayers; ++layer)
|
||||
{
|
||||
label offset = layer*surfacePoints.size();
|
||||
const label offset = layer*surfacePoints.size();
|
||||
|
||||
forAll(surfacePoints, i)
|
||||
{
|
||||
@ -62,13 +62,12 @@ Foam::Xfer<Foam::pointField> Foam::extrudedMesh::extrudedPoints
|
||||
}
|
||||
}
|
||||
|
||||
// return points for transferring
|
||||
return xferMove(ePoints);
|
||||
return ePoints;
|
||||
}
|
||||
|
||||
|
||||
template<class Face, template<class> class FaceList, class PointField>
|
||||
Foam::Xfer<Foam::faceList> Foam::extrudedMesh::extrudedFaces
|
||||
Foam::faceList Foam::extrudedMesh::extrudedFaces
|
||||
(
|
||||
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel& model
|
||||
@ -188,13 +187,13 @@ Foam::Xfer<Foam::faceList> Foam::extrudedMesh::extrudedFaces
|
||||
);
|
||||
}
|
||||
|
||||
// return points for transferring
|
||||
return xferMove(eFaces);
|
||||
|
||||
return eFaces;
|
||||
}
|
||||
|
||||
|
||||
template<class Face, template<class> class FaceList, class PointField>
|
||||
Foam::Xfer<Foam::cellList> Foam::extrudedMesh::extrudedCells
|
||||
Foam::cellList Foam::extrudedMesh::extrudedCells
|
||||
(
|
||||
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
|
||||
const extrudeModel& model
|
||||
@ -295,8 +294,7 @@ Foam::Xfer<Foam::cellList> Foam::extrudedMesh::extrudedCells
|
||||
facei++;
|
||||
}
|
||||
|
||||
// return points for transferring
|
||||
return xferMove(eCells);
|
||||
return eCells;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1880,7 +1880,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
}
|
||||
const primitiveFacePatch extrudePatch(zoneFaces.xfer(), mesh.points());
|
||||
const primitiveFacePatch extrudePatch(std::move(zoneFaces), mesh.points());
|
||||
|
||||
|
||||
Pstream::listCombineGather(isInternal, orEqOp<bool>());
|
||||
@ -2405,10 +2405,7 @@ int main(int argc, char *argv[])
|
||||
IOobject::AUTO_WRITE,
|
||||
false
|
||||
),
|
||||
xferCopy(pointField()),
|
||||
xferCopy(faceList()),
|
||||
xferCopy(labelList()),
|
||||
xferCopy(labelList()),
|
||||
Zero,
|
||||
false
|
||||
);
|
||||
|
||||
@ -2470,7 +2467,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// Update numbering on extruder.
|
||||
extruder.updateMesh(shellMap);
|
||||
extruder.updateMesh(shellMap());
|
||||
|
||||
|
||||
// Calculate offsets from shell mesh back to original mesh
|
||||
@ -2818,7 +2815,7 @@ int main(int argc, char *argv[])
|
||||
addBafflesMap = meshMod.changeMesh(mesh, false);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(addBafflesMap);
|
||||
mesh.updateMesh(addBafflesMap());
|
||||
|
||||
|
||||
//XXXXXX
|
||||
|
||||
@ -247,7 +247,7 @@ void Foam::patchToPoly2DMesh::addPatchFacesToOwner()
|
||||
<< nExternalEdges << endl;
|
||||
}
|
||||
|
||||
owner_ = newOwner.xfer();
|
||||
owner_.transfer(newOwner);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -184,24 +184,21 @@ int main(int argc, char *argv[])
|
||||
|
||||
poly2DMesh.createMesh();
|
||||
|
||||
mesh.reset
|
||||
mesh = autoPtr<polyMesh>::New
|
||||
(
|
||||
new polyMesh
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
polyMesh::defaultRegion,
|
||||
runTimeExtruded.constant(),
|
||||
runTimeExtruded,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
xferMove(poly2DMesh.points()),
|
||||
xferMove(poly2DMesh.faces()),
|
||||
xferMove(poly2DMesh.owner()),
|
||||
xferMove(poly2DMesh.neighbour())
|
||||
)
|
||||
polyMesh::defaultRegion,
|
||||
runTimeExtruded.constant(),
|
||||
runTimeExtruded,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
std::move(poly2DMesh.points()),
|
||||
std::move(poly2DMesh.faces()),
|
||||
std::move(poly2DMesh.owner()),
|
||||
std::move(poly2DMesh.neighbour())
|
||||
);
|
||||
|
||||
Info<< "Constructing patches." << endl;
|
||||
@ -224,17 +221,14 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else if (surfaceFormat == POLYMESH2D)
|
||||
{
|
||||
mesh.reset
|
||||
mesh = autoPtr<polyMesh>::New
|
||||
(
|
||||
new polyMesh
|
||||
Foam::IOobject
|
||||
(
|
||||
Foam::IOobject
|
||||
(
|
||||
Foam::polyMesh::defaultRegion,
|
||||
runTimeExtruded.timeName(),
|
||||
runTimeExtruded,
|
||||
Foam::IOobject::MUST_READ
|
||||
)
|
||||
Foam::polyMesh::defaultRegion,
|
||||
runTimeExtruded.timeName(),
|
||||
runTimeExtruded,
|
||||
Foam::IOobject::MUST_READ
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -251,7 +245,7 @@ int main(int argc, char *argv[])
|
||||
// Create a mesh from topo changes.
|
||||
autoPtr<mapPolyMesh> morphMap = meshMod().changeMesh(mesh(), false);
|
||||
|
||||
mesh().updateMesh(morphMap);
|
||||
mesh().updateMesh(morphMap());
|
||||
|
||||
{
|
||||
edgeCollapser collapser(mesh());
|
||||
@ -302,7 +296,7 @@ int main(int argc, char *argv[])
|
||||
autoPtr<mapPolyMesh> morphMap
|
||||
= meshModCollapse.changeMesh(mesh(), false);
|
||||
|
||||
mesh().updateMesh(morphMap);
|
||||
mesh().updateMesh(morphMap());
|
||||
}
|
||||
|
||||
if (!overwrite)
|
||||
|
||||
@ -141,14 +141,11 @@ autoPtr<mapDistribute> buildMap
|
||||
|
||||
List<Map<label>> compactMap;
|
||||
|
||||
return autoPtr<mapDistribute>
|
||||
return autoPtr<mapDistribute>::New
|
||||
(
|
||||
new mapDistribute
|
||||
(
|
||||
globalIndexing,
|
||||
pointPoints,
|
||||
compactMap
|
||||
)
|
||||
globalIndexing,
|
||||
pointPoints,
|
||||
compactMap
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -593,23 +593,20 @@ Foam::DelaunayMesh<Triangulation>::createMesh
|
||||
|
||||
Info<< "Creating mesh" << endl;
|
||||
|
||||
autoPtr<polyMesh> meshPtr
|
||||
auto meshPtr = autoPtr<polyMesh>::New
|
||||
(
|
||||
new polyMesh
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
name,
|
||||
time().timeName(),
|
||||
time(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
xferMove(points),
|
||||
xferMove(faces),
|
||||
xferMove(owner),
|
||||
xferMove(neighbour)
|
||||
)
|
||||
name,
|
||||
time().timeName(),
|
||||
time(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
std::move(points),
|
||||
std::move(faces),
|
||||
std::move(owner),
|
||||
std::move(neighbour)
|
||||
);
|
||||
|
||||
Info<< "Adding patches" << endl;
|
||||
|
||||
@ -105,14 +105,11 @@ Foam::DistributedDelaunayMesh<Triangulation>::buildMap
|
||||
}
|
||||
}
|
||||
|
||||
return autoPtr<mapDistribute>
|
||||
return autoPtr<mapDistribute>::New
|
||||
(
|
||||
new mapDistribute
|
||||
(
|
||||
constructSize,
|
||||
sendMap.xfer(),
|
||||
constructMap.xfer()
|
||||
)
|
||||
constructSize,
|
||||
std::move(sendMap),
|
||||
std::move(constructMap)
|
||||
);
|
||||
}
|
||||
|
||||
@ -142,13 +139,6 @@ Foam::DistributedDelaunayMesh<Triangulation>::DistributedDelaunayMesh
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Triangulation>
|
||||
Foam::DistributedDelaunayMesh<Triangulation>::~DistributedDelaunayMesh()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Triangulation>
|
||||
@ -491,7 +481,8 @@ Foam::label Foam::DistributedDelaunayMesh<Triangulation>::referVertices
|
||||
|
||||
const label preDistributionSize = parallelVertices.size();
|
||||
|
||||
mapDistribute pointMap = buildMap(targetProcessor);
|
||||
autoPtr<mapDistribute> pointMapPtr = buildMap(targetProcessor);
|
||||
mapDistribute& pointMap = *pointMapPtr;
|
||||
|
||||
// Make a copy of the original list.
|
||||
DynamicList<Vb> originalParallelVertices(parallelVertices);
|
||||
|
||||
@ -141,7 +141,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
~DistributedDelaunayMesh();
|
||||
~DistributedDelaunayMesh() = default;
|
||||
|
||||
|
||||
// Queries
|
||||
|
||||
@ -36,9 +36,7 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(backgroundMeshDecomposition, 0);
|
||||
|
||||
defineTypeNameAndDebug(backgroundMeshDecomposition, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -114,14 +112,11 @@ Foam::autoPtr<Foam::mapDistribute> Foam::backgroundMeshDecomposition::buildMap
|
||||
}
|
||||
}
|
||||
|
||||
return autoPtr<mapDistribute>
|
||||
return autoPtr<mapDistribute>::New
|
||||
(
|
||||
new mapDistribute
|
||||
(
|
||||
constructSize,
|
||||
sendMap.xfer(),
|
||||
constructMap.xfer()
|
||||
)
|
||||
constructSize,
|
||||
std::move(sendMap),
|
||||
std::move(constructMap)
|
||||
);
|
||||
}
|
||||
|
||||
@ -248,10 +243,10 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
||||
);
|
||||
|
||||
// Update fields
|
||||
mesh_.updateMesh(map);
|
||||
mesh_.updateMesh(map());
|
||||
|
||||
// Update numbering of cells/vertices.
|
||||
meshCutter_.updateMesh(map);
|
||||
meshCutter_.updateMesh(map());
|
||||
|
||||
{
|
||||
// Map volumeStatus
|
||||
@ -357,11 +352,11 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
||||
);
|
||||
|
||||
// Update fields
|
||||
mesh_.updateMesh(map);
|
||||
mesh_.updateMesh(map());
|
||||
|
||||
// Update numbering of cells/vertices.
|
||||
meshCutter_.updateMesh(map);
|
||||
cellRemover.updateMesh(map);
|
||||
meshCutter_.updateMesh(map());
|
||||
cellRemover.updateMesh(map());
|
||||
|
||||
{
|
||||
// Map volumeStatus
|
||||
@ -416,7 +411,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
||||
newDecomp
|
||||
);
|
||||
|
||||
meshCutter_.distribute(mapDist);
|
||||
meshCutter_.distribute(mapDist());
|
||||
|
||||
mapDist().distributeCellData(volumeStatus);
|
||||
|
||||
@ -840,12 +835,6 @@ Foam::backgroundMeshDecomposition::backgroundMeshDecomposition
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::backgroundMeshDecomposition::~backgroundMeshDecomposition()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::mapDistributePolyMesh>
|
||||
@ -954,10 +943,10 @@ Foam::backgroundMeshDecomposition::distribute
|
||||
);
|
||||
|
||||
// Update fields
|
||||
mesh_.updateMesh(map);
|
||||
mesh_.updateMesh(map());
|
||||
|
||||
// Update numbering of cells/vertices.
|
||||
meshCutter_.updateMesh(map);
|
||||
meshCutter_.updateMesh(map());
|
||||
|
||||
Info<< " Background mesh refined from "
|
||||
<< returnReduce(map().nOldCells(), sumOp<label>())
|
||||
@ -1000,7 +989,7 @@ Foam::backgroundMeshDecomposition::distribute
|
||||
|
||||
autoPtr<mapDistributePolyMesh> mapDist = distributor.distribute(newDecomp);
|
||||
|
||||
meshCutter_.distribute(mapDist);
|
||||
meshCutter_.distribute(mapDist());
|
||||
|
||||
if (debug)
|
||||
{
|
||||
|
||||
@ -204,7 +204,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
~backgroundMeshDecomposition();
|
||||
~backgroundMeshDecomposition() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -34,7 +34,7 @@ const Foam::fvMesh& Foam::backgroundMeshDecomposition::mesh() const
|
||||
const Foam::indexedOctree<Foam::treeDataBPatch>&
|
||||
Foam::backgroundMeshDecomposition::tree() const
|
||||
{
|
||||
return bFTreePtr_();
|
||||
return *bFTreePtr_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -267,7 +267,7 @@ void Foam::controlMeshRefinement::initialMeshPopulation
|
||||
|
||||
Info<< "Inserting points from " << controlFunction.name()
|
||||
<< " (" << controlFunction.type() << ")" << endl;
|
||||
Info<< " Force insertion is " << forceInsertion.asText() << endl;
|
||||
Info<< " Force insertion is " << forceInsertion.c_str() << endl;
|
||||
|
||||
pointField pts;
|
||||
scalarField sizes;
|
||||
@ -453,7 +453,7 @@ void Foam::controlMeshRefinement::initialMeshPopulation
|
||||
|
||||
Info<< "Inserting points from " << controlFunction.name()
|
||||
<< " (" << controlFunction.type() << ")" << endl;
|
||||
Info<< " Force insertion is " << forceInsertion.asText() << endl;
|
||||
Info<< " Force insertion is " << forceInsertion.c_str() << endl;
|
||||
|
||||
DynamicList<Foam::point> extraPts;
|
||||
DynamicList<scalar> extraSizes;
|
||||
|
||||
@ -93,14 +93,11 @@ Foam::autoPtr<Foam::mapDistribute> Foam::smoothAlignmentSolver::buildReferredMap
|
||||
indices.transfer(dynIndices);
|
||||
|
||||
List<Map<label>> compactMap;
|
||||
return autoPtr<mapDistribute>
|
||||
return autoPtr<mapDistribute>::New
|
||||
(
|
||||
new mapDistribute
|
||||
(
|
||||
globalIndexing,
|
||||
indices,
|
||||
compactMap
|
||||
)
|
||||
globalIndexing,
|
||||
indices,
|
||||
compactMap
|
||||
);
|
||||
}
|
||||
|
||||
@ -157,14 +154,11 @@ Foam::autoPtr<Foam::mapDistribute> Foam::smoothAlignmentSolver::buildMap
|
||||
}
|
||||
|
||||
List<Map<label>> compactMap;
|
||||
return autoPtr<mapDistribute>
|
||||
return autoPtr<mapDistribute>::New
|
||||
(
|
||||
new mapDistribute
|
||||
(
|
||||
globalIndexing,
|
||||
pointPoints,
|
||||
compactMap
|
||||
)
|
||||
globalIndexing,
|
||||
pointPoints,
|
||||
compactMap
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -509,7 +509,7 @@ void Foam::conformalVoronoiMesh::buildCellSizeAndAlignmentMesh()
|
||||
if (!distributeBackground(cellSizeMesh))
|
||||
{
|
||||
// Synchronise the cell size mesh if it has not been distributed
|
||||
cellSizeMesh.distribute(decomposition_);
|
||||
cellSizeMesh.distribute(decomposition_());
|
||||
}
|
||||
}
|
||||
|
||||
@ -531,7 +531,7 @@ void Foam::conformalVoronoiMesh::buildCellSizeAndAlignmentMesh()
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
cellSizeMesh.distribute(decomposition_);
|
||||
cellSizeMesh.distribute(decomposition_());
|
||||
}
|
||||
|
||||
Info<< " Iteration " << i
|
||||
@ -549,7 +549,7 @@ void Foam::conformalVoronoiMesh::buildCellSizeAndAlignmentMesh()
|
||||
// Need to distribute the cell size mesh to cover the background mesh
|
||||
if (!distributeBackground(cellSizeMesh))
|
||||
{
|
||||
cellSizeMesh.distribute(decomposition_);
|
||||
cellSizeMesh.distribute(decomposition_());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -727,23 +727,20 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
|
||||
labelList cellToDelaunayVertex(removeUnusedCells(owner, neighbour));
|
||||
cellCentres = pointField(cellCentres, cellToDelaunayVertex);
|
||||
|
||||
autoPtr<polyMesh> meshPtr
|
||||
auto meshPtr = autoPtr<polyMesh>::New
|
||||
(
|
||||
new polyMesh
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"foamyHexMesh_temporary",
|
||||
runTime_.timeName(),
|
||||
runTime_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
xferCopy(pts),
|
||||
xferMove(faces),
|
||||
xferMove(owner),
|
||||
xferMove(neighbour)
|
||||
)
|
||||
"foamyHexMesh_temporary",
|
||||
runTime_.timeName(),
|
||||
runTime_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
pointField(pts), // Copy of points
|
||||
std::move(faces),
|
||||
std::move(owner),
|
||||
std::move(neighbour)
|
||||
);
|
||||
|
||||
polyMesh& pMesh = meshPtr();
|
||||
|
||||
@ -563,7 +563,7 @@ Foam::conformalVoronoiMesh::decomposition() const
|
||||
<< exit(FatalError) << endl;
|
||||
}
|
||||
|
||||
return decomposition_();
|
||||
return *decomposition_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -404,16 +404,7 @@ Foam::autoPtr<Foam::fvMesh> Foam::conformalVoronoiMesh::createDummyMesh
|
||||
const PtrList<dictionary>& patchDicts
|
||||
) const
|
||||
{
|
||||
autoPtr<fvMesh> meshPtr
|
||||
(
|
||||
new fvMesh
|
||||
(
|
||||
io,
|
||||
xferCopy(pointField()),
|
||||
xferCopy(faceList()),
|
||||
xferCopy(cellList())
|
||||
)
|
||||
);
|
||||
auto meshPtr = autoPtr<fvMesh>::New(io, Zero);
|
||||
fvMesh& mesh = meshPtr();
|
||||
|
||||
List<polyPatch*> patches(patchDicts.size());
|
||||
@ -827,10 +818,10 @@ void Foam::conformalVoronoiMesh::writeMesh
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
xferMove(points),
|
||||
xferMove(faces),
|
||||
xferMove(owner),
|
||||
xferMove(neighbour)
|
||||
std::move(points),
|
||||
std::move(faces),
|
||||
std::move(owner),
|
||||
std::move(neighbour)
|
||||
);
|
||||
|
||||
Info<< indent << "Adding patches to mesh" << endl;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user