mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: use emplace_set, emplace_back to simplify code
- eg, for cloud fields, tmp emplace when reading fields etc.
This commit is contained in:
@ -54,56 +54,44 @@ Description
|
||||
);
|
||||
|
||||
// An empty zone for cut points
|
||||
pzs.append
|
||||
(
|
||||
new pointZone
|
||||
pzs.emplace_back
|
||||
(
|
||||
mergeName + "CutPointZone",
|
||||
pzs.size(),
|
||||
pzs.size(), // index
|
||||
pzs
|
||||
)
|
||||
);
|
||||
cleanupPointZones.insert(pzs.last().name());
|
||||
cleanupPointZones.insert(pzs.back().name());
|
||||
|
||||
// Coupling side 0 (master)
|
||||
fzs.append
|
||||
(
|
||||
new faceZone
|
||||
fzs.emplace_back
|
||||
(
|
||||
mergeName + "Side0Zone",
|
||||
identity(patch0.range()),
|
||||
false, // none are flipped
|
||||
fzs.size(),
|
||||
fzs.size(), // index
|
||||
fzs
|
||||
)
|
||||
);
|
||||
cleanupFaceZones.insert(fzs.last().name());
|
||||
cleanupFaceZones.insert(fzs.back().name());
|
||||
|
||||
// Coupling side 1 (slave)
|
||||
fzs.append
|
||||
(
|
||||
new faceZone
|
||||
fzs.emplace_back
|
||||
(
|
||||
mergeName + "Side1Zone",
|
||||
identity(patch1.range()),
|
||||
false, // none are flipped
|
||||
fzs.size(),
|
||||
fzs.size(), // index
|
||||
fzs
|
||||
)
|
||||
);
|
||||
cleanupFaceZones.insert(fzs.last().name());
|
||||
cleanupFaceZones.insert(fzs.back().name());
|
||||
|
||||
// An empty zone for cut faces
|
||||
fzs.append
|
||||
(
|
||||
new faceZone
|
||||
fzs.emplace_back
|
||||
(
|
||||
mergeName + "CutFaceZone",
|
||||
fzs.size(),
|
||||
fzs.size(), // index
|
||||
fzs
|
||||
)
|
||||
);
|
||||
cleanupFaceZones.insert(fzs.last().name());
|
||||
cleanupFaceZones.insert(fzs.back().name());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -139,7 +139,7 @@ void rewriteBoundary
|
||||
|
||||
if (patchDict.found("neighbourPatch"))
|
||||
{
|
||||
patches.set(patchi, oldPatches.set(patchi, nullptr));
|
||||
patches.set(patchi, oldPatches.release(patchi));
|
||||
oldToNew[patchi] = newPatchi++;
|
||||
|
||||
// Check if patches come from automatic conversion
|
||||
@ -187,7 +187,7 @@ void rewriteBoundary
|
||||
const dictionary patchDict(patches[patchi].dict());
|
||||
|
||||
// Change entry on this side
|
||||
patches.set(patchi, oldPatches.set(patchi, nullptr));
|
||||
patches.set(patchi, oldPatches.release(patchi));
|
||||
oldToNew[patchi] = newPatchi++;
|
||||
dictionary& thisPatchDict = patches[patchi].dict();
|
||||
thisPatchDict.add("neighbourPatch", nbrName);
|
||||
@ -230,7 +230,7 @@ void rewriteBoundary
|
||||
}
|
||||
else
|
||||
{
|
||||
patches.set(patchi, oldPatches.set(patchi, nullptr));
|
||||
patches.set(patchi, oldPatches.release(patchi));
|
||||
oldToNew[patchi] = newPatchi++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -199,25 +199,34 @@ void PatchToPatchInterpolation<FromPatch, ToPatch>::calcPointAddressing() const
|
||||
if (doWeights)
|
||||
{
|
||||
// Set interpolation pointWeights
|
||||
pointWeights.set(pointi, new scalarField(hitFace.size()));
|
||||
const pointField hitFacePoints
|
||||
(
|
||||
hitFace.points(fromPatchPoints)
|
||||
);
|
||||
|
||||
pointField hitFacePoints = hitFace.points(fromPatchPoints);
|
||||
auto& pointiWeights =
|
||||
pointWeights.emplace_set(pointi, hitFacePoints.size());
|
||||
|
||||
scalar sumWeight = 0;
|
||||
|
||||
forAll(hitFacePoints, masterPointi)
|
||||
{
|
||||
pointWeights[pointi][masterPointi] =
|
||||
1.0/
|
||||
const point& p = hitFacePoints[masterPointi];
|
||||
|
||||
const scalar w =
|
||||
(
|
||||
hitPoint.dist(hitFacePoints[masterPointi])
|
||||
+ VSMALL
|
||||
1.0 / (hitPoint.dist(p) + VSMALL)
|
||||
);
|
||||
|
||||
pointiWeights[masterPointi] = w;
|
||||
sumWeight += w;
|
||||
}
|
||||
|
||||
pointWeights[pointi] /= sum(pointWeights[pointi]);
|
||||
pointiWeights /= sumWeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
pointWeights.set(pointi, new scalarField());
|
||||
pointWeights.emplace_set(pointi);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -296,7 +305,9 @@ void PatchToPatchInterpolation<FromPatch, ToPatch>::calcFaceAddressing() const
|
||||
const labelList& neighbours =
|
||||
fromPatchFaceFaces[faceAddressing[facei]];
|
||||
|
||||
scalar m = curHit.hitPoint().dist(hitFaceCentre);
|
||||
const point& hitPoint = curHit.hitPoint();
|
||||
|
||||
scalar m = hitPoint.dist(hitFaceCentre);
|
||||
|
||||
if
|
||||
(
|
||||
@ -304,8 +315,8 @@ void PatchToPatchInterpolation<FromPatch, ToPatch>::calcFaceAddressing() const
|
||||
|| neighbours.empty()
|
||||
)
|
||||
{
|
||||
faceWeights.set(facei, new scalarField(1));
|
||||
faceWeights[facei][0] = 1.0;
|
||||
auto& faceiWeights = faceWeights.emplace_set(facei, 1);
|
||||
faceiWeights[0] = 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -313,29 +324,33 @@ void PatchToPatchInterpolation<FromPatch, ToPatch>::calcFaceAddressing() const
|
||||
|
||||
// The first coefficient corresponds to the centre face.
|
||||
// The rest is ordered in the same way as the faceFaces list.
|
||||
faceWeights.set(facei, new scalarField(neighbours.size() + 1));
|
||||
|
||||
faceWeights[facei][0] = 1.0/m;
|
||||
auto& faceiWeights =
|
||||
faceWeights.emplace_set(facei, neighbours.size() + 1);
|
||||
|
||||
forAll(neighbours, nI)
|
||||
faceiWeights[0] = 1.0/m;
|
||||
|
||||
scalar sumWeight = faceiWeights[0];
|
||||
|
||||
forAll(neighbours, nbri)
|
||||
{
|
||||
faceWeights[facei][nI + 1] =
|
||||
1.0/
|
||||
const point& p = fromPatchFaceCentres[neighbours[nbri]];
|
||||
|
||||
const scalar w =
|
||||
(
|
||||
curHit.hitPoint().dist
|
||||
(
|
||||
fromPatchFaceCentres[neighbours[nI]]
|
||||
)
|
||||
+ VSMALL
|
||||
1.0 / (hitPoint.dist(p) + VSMALL)
|
||||
);
|
||||
}
|
||||
|
||||
faceWeights[nbri+1] = w;
|
||||
sumWeight += w;
|
||||
}
|
||||
|
||||
faceWeights[facei] /= sum(faceWeights[facei]);
|
||||
faceiWeights /= sumWeight;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
faceWeights.set(facei, new scalarField());
|
||||
faceWeights.emplace_set(facei);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,8 +160,7 @@ void Foam::fieldsDistributor::readFieldsImpl
|
||||
#endif
|
||||
|
||||
|
||||
fields.free();
|
||||
fields.resize(masterNames.size());
|
||||
fields.resize_null(masterNames.size());
|
||||
|
||||
if (fields.empty())
|
||||
{
|
||||
|
||||
@ -109,7 +109,7 @@ void Foam::fvMeshAdder::MapVolField
|
||||
// Sort deleted ones last so is now in newPatch ordering
|
||||
bfld.reorder(oldToNew);
|
||||
// Extend to covers all patches
|
||||
bfld.setSize(mesh.boundaryMesh().size());
|
||||
bfld.resize(mesh.boundaryMesh().size());
|
||||
// Delete unused patches
|
||||
for
|
||||
(
|
||||
@ -118,7 +118,7 @@ void Foam::fvMeshAdder::MapVolField
|
||||
newPatchi++
|
||||
)
|
||||
{
|
||||
bfld.set(newPatchi, nullptr);
|
||||
bfld.release(newPatchi);
|
||||
}
|
||||
|
||||
|
||||
@ -419,7 +419,7 @@ void Foam::fvMeshAdder::MapSurfaceField
|
||||
// Sort deleted ones last so is now in newPatch ordering
|
||||
bfld.reorder(oldToNew);
|
||||
// Extend to covers all patches
|
||||
bfld.setSize(mesh.boundaryMesh().size());
|
||||
bfld.resize(mesh.boundaryMesh().size());
|
||||
// Delete unused patches
|
||||
for
|
||||
(
|
||||
@ -428,7 +428,7 @@ void Foam::fvMeshAdder::MapSurfaceField
|
||||
newPatchi++
|
||||
)
|
||||
{
|
||||
bfld.set(newPatchi, nullptr);
|
||||
bfld.release(newPatchi);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -222,7 +222,7 @@ Foam::wordList Foam::fvMeshDistribute::mergeWordList(const wordList& procNames)
|
||||
}
|
||||
|
||||
|
||||
void Foam::fvMeshDistribute::printMeshInfo(const fvMesh& mesh)
|
||||
void Foam::fvMeshDistribute::printMeshInfo(const polyMesh& mesh)
|
||||
{
|
||||
Pout<< "Primitives:" << nl
|
||||
<< " points :" << mesh.nPoints() << nl
|
||||
@ -231,52 +231,35 @@ void Foam::fvMeshDistribute::printMeshInfo(const fvMesh& mesh)
|
||||
<< " faces :" << mesh.nFaces() << nl
|
||||
<< " cells :" << mesh.nCells() << nl;
|
||||
|
||||
const fvBoundaryMesh& patches = mesh.boundary();
|
||||
|
||||
Pout<< "Patches:" << endl;
|
||||
forAll(patches, patchi)
|
||||
for (const polyPatch& pp : mesh.boundaryMesh())
|
||||
{
|
||||
const polyPatch& pp = patches[patchi].patch();
|
||||
|
||||
Pout<< " " << patchi << " name:" << pp.name()
|
||||
Pout<< " " << pp.index() << " name:" << pp.name()
|
||||
<< " size:" << pp.size()
|
||||
<< " start:" << pp.start()
|
||||
<< " type:" << pp.type()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (mesh.pointZones().size())
|
||||
if (mesh.pointZones().empty()) Pout<< "PointZones:" << endl;
|
||||
for (const auto& zn : mesh.pointZones())
|
||||
{
|
||||
Pout<< "PointZones:" << endl;
|
||||
forAll(mesh.pointZones(), zoneI)
|
||||
{
|
||||
const pointZone& pz = mesh.pointZones()[zoneI];
|
||||
Pout<< " " << zoneI << " name:" << pz.name()
|
||||
<< " size:" << pz.size()
|
||||
<< endl;
|
||||
Pout<< " " << zn.index() << " name:" << zn.name()
|
||||
<< " size:" << zn.size() << endl;
|
||||
}
|
||||
}
|
||||
if (mesh.faceZones().size())
|
||||
|
||||
if (!mesh.faceZones().empty()) Pout<< "FaceZones:" << endl;
|
||||
for (const auto& zn : mesh.faceZones())
|
||||
{
|
||||
Pout<< "FaceZones:" << endl;
|
||||
forAll(mesh.faceZones(), zoneI)
|
||||
{
|
||||
const faceZone& fz = mesh.faceZones()[zoneI];
|
||||
Pout<< " " << zoneI << " name:" << fz.name()
|
||||
<< " size:" << fz.size()
|
||||
<< endl;
|
||||
Pout<< " " << zn.index() << " name:" << zn.name()
|
||||
<< " size:" << zn.size() << endl;
|
||||
}
|
||||
}
|
||||
if (mesh.cellZones().size())
|
||||
|
||||
if (!mesh.cellZones().empty()) Pout<< "CellZones:" << endl;
|
||||
for (const auto& zn : mesh.cellZones())
|
||||
{
|
||||
Pout<< "CellZones:" << endl;
|
||||
forAll(mesh.cellZones(), zoneI)
|
||||
{
|
||||
const cellZone& cz = mesh.cellZones()[zoneI];
|
||||
Pout<< " " << zoneI << " name:" << cz.name()
|
||||
<< " size:" << cz.size()
|
||||
<< endl;
|
||||
}
|
||||
Pout<< " " << zn.index() << " name:" << zn.name()
|
||||
<< " size:" << zn.size() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -960,7 +943,7 @@ void Foam::fvMeshDistribute::getCouplingData
|
||||
|
||||
|
||||
// Collect coupled (collocated) points
|
||||
sourcePointMaster.setSize(mesh_.nPoints());
|
||||
sourcePointMaster.resize_nocopy(mesh_.nPoints());
|
||||
sourcePointMaster = -1;
|
||||
{
|
||||
// Assign global master point
|
||||
@ -1208,9 +1191,9 @@ void Foam::fvMeshDistribute::findCouples
|
||||
{
|
||||
if (meshes.set(meshi))
|
||||
{
|
||||
dynLocalFace[meshi].setCapacity(nProcFaces[meshi]);
|
||||
dynRemoteProc[meshi].setCapacity(nProcFaces[meshi]);
|
||||
dynRemoteFace[meshi].setCapacity(nProcFaces[meshi]);
|
||||
dynLocalFace[meshi].reserve(nProcFaces[meshi]);
|
||||
dynRemoteProc[meshi].reserve(nProcFaces[meshi]);
|
||||
dynRemoteFace[meshi].reserve(nProcFaces[meshi]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2515,37 +2498,36 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
|
||||
PtrList<fvMesh> domainMeshPtrs(Pstream::nProcs());
|
||||
|
||||
PtrList<PtrList<volScalarField>> vsfs(Pstream::nProcs());
|
||||
PtrList<PtrList<volVectorField>> vvfs(Pstream::nProcs());
|
||||
PtrList<PtrList<volSphericalTensorField>> vsptfs(Pstream::nProcs());
|
||||
PtrList<PtrList<volSymmTensorField>> vsytfs(Pstream::nProcs());
|
||||
PtrList<PtrList<volTensorField>> vtfs(Pstream::nProcs());
|
||||
// Define field storage lists
|
||||
#undef doLocalCode
|
||||
#define doLocalCode(FieldType, Variable) \
|
||||
PtrList<PtrList<FieldType>> Variable(UPstream::nProcs());
|
||||
|
||||
PtrList<PtrList<surfaceScalarField>> ssfs(Pstream::nProcs());
|
||||
PtrList<PtrList<surfaceVectorField>> svfs(Pstream::nProcs());
|
||||
PtrList<PtrList<surfaceSphericalTensorField>> ssptfs
|
||||
(
|
||||
Pstream::nProcs()
|
||||
);
|
||||
PtrList<PtrList<surfaceSymmTensorField>> ssytfs(Pstream::nProcs());
|
||||
PtrList<PtrList<surfaceTensorField>> stfs(Pstream::nProcs());
|
||||
doLocalCode(volScalarField, vsfs);
|
||||
doLocalCode(volVectorField, vvfs);
|
||||
doLocalCode(volSphericalTensorField, vsptfs);
|
||||
doLocalCode(volSymmTensorField, vsytfs);
|
||||
doLocalCode(volTensorField, vtfs);
|
||||
|
||||
doLocalCode(surfaceScalarField, ssfs);
|
||||
doLocalCode(surfaceVectorField, svfs);
|
||||
doLocalCode(surfaceSphericalTensorField, ssptfs);
|
||||
doLocalCode(surfaceSymmTensorField, ssytfs);
|
||||
doLocalCode(surfaceTensorField, stfs);
|
||||
|
||||
doLocalCode(volScalarField::Internal, dsfs);
|
||||
doLocalCode(volVectorField::Internal, dvfs);
|
||||
doLocalCode(volSphericalTensorField::Internal, dsptfs)
|
||||
doLocalCode(volSymmTensorField::Internal, dsytfs);
|
||||
doLocalCode(volTensorField::Internal, dtfs);
|
||||
|
||||
#undef doLocalCode
|
||||
|
||||
PtrList<PtrList<volScalarField::Internal>> dsfs(Pstream::nProcs());
|
||||
PtrList<PtrList<volVectorField::Internal>> dvfs(Pstream::nProcs());
|
||||
PtrList<PtrList<volSphericalTensorField::Internal>> dstfs
|
||||
(
|
||||
Pstream::nProcs()
|
||||
);
|
||||
PtrList<PtrList<volSymmTensorField::Internal>> dsytfs
|
||||
(
|
||||
Pstream::nProcs()
|
||||
);
|
||||
PtrList<PtrList<volTensorField::Internal>> dtfs(Pstream::nProcs());
|
||||
|
||||
forAll(nRecvCells, sendProc)
|
||||
{
|
||||
// Did processor sendProc send anything to me?
|
||||
if (sendProc != Pstream::myProcNo() && nRecvCells[sendProc] > 0)
|
||||
if (sendProc != UPstream::myProcNo() && nRecvCells[sendProc] > 0)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
@ -2561,25 +2543,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
UIPstream str(sendProc, pBufs);
|
||||
|
||||
|
||||
// Receive from sendProc
|
||||
domainSourceFaces.set(sendProc, new labelList(0));
|
||||
labelList& domainSourceFace = domainSourceFaces[sendProc];
|
||||
|
||||
domainSourceProcs.set(sendProc, new labelList(0));
|
||||
labelList& domainSourceProc = domainSourceProcs[sendProc];
|
||||
|
||||
domainSourcePatchs.set(sendProc, new labelList(0));
|
||||
labelList& domainSourcePatch = domainSourcePatchs[sendProc];
|
||||
|
||||
domainSourceNewNbrProcs.set(sendProc, new labelList(0));
|
||||
labelList& domainSourceNewNbrProc =
|
||||
domainSourceNewNbrProcs[sendProc];
|
||||
|
||||
domainSourcePointMasters.set(sendProc, new labelList(0));
|
||||
labelList& domainSourcePointMaster =
|
||||
domainSourcePointMasters[sendProc];
|
||||
|
||||
// Opposite of sendMesh
|
||||
// Receive from sendProc - opposite of sendMesh
|
||||
{
|
||||
autoPtr<fvMesh> domainMeshPtr = receiveMesh
|
||||
(
|
||||
@ -2589,14 +2553,15 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
cellZoneNames,
|
||||
|
||||
const_cast<Time&>(mesh_.time()),
|
||||
domainSourceFace,
|
||||
domainSourceProc,
|
||||
domainSourcePatch,
|
||||
domainSourceNewNbrProc,
|
||||
domainSourcePointMaster,
|
||||
|
||||
domainSourceFaces.emplace_set(sendProc),
|
||||
domainSourceProcs.emplace_set(sendProc),
|
||||
domainSourcePatchs.emplace_set(sendProc),
|
||||
domainSourceNewNbrProcs.emplace_set(sendProc),
|
||||
domainSourcePointMasters.emplace_set(sendProc),
|
||||
str
|
||||
);
|
||||
domainMeshPtrs.set(sendProc, domainMeshPtr.ptr());
|
||||
domainMeshPtrs.set(sendProc, std::move(domainMeshPtr));
|
||||
fvMesh& domainMesh = domainMeshPtrs[sendProc];
|
||||
// Force construction of various on mesh.
|
||||
//(void)domainMesh.globalData();
|
||||
@ -2606,174 +2571,39 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
// of problems reading consecutive fields from single stream.
|
||||
dictionary fieldDicts(str);
|
||||
|
||||
// Vol fields
|
||||
vsfs.set(sendProc, new PtrList<volScalarField>(0));
|
||||
receiveFields<volScalarField>
|
||||
(
|
||||
sendProc,
|
||||
allFieldNames,
|
||||
domainMesh,
|
||||
vsfs[sendProc],
|
||||
fieldDicts
|
||||
);
|
||||
vvfs.set(sendProc, new PtrList<volVectorField>(0));
|
||||
receiveFields<volVectorField>
|
||||
(
|
||||
sendProc,
|
||||
allFieldNames,
|
||||
domainMesh,
|
||||
vvfs[sendProc],
|
||||
fieldDicts
|
||||
);
|
||||
vsptfs.set
|
||||
(
|
||||
sendProc,
|
||||
new PtrList<volSphericalTensorField>(0)
|
||||
);
|
||||
receiveFields<volSphericalTensorField>
|
||||
(
|
||||
sendProc,
|
||||
allFieldNames,
|
||||
domainMesh,
|
||||
vsptfs[sendProc],
|
||||
fieldDicts
|
||||
);
|
||||
vsytfs.set(sendProc, new PtrList<volSymmTensorField>(0));
|
||||
receiveFields<volSymmTensorField>
|
||||
(
|
||||
sendProc,
|
||||
allFieldNames,
|
||||
domainMesh,
|
||||
vsytfs[sendProc],
|
||||
fieldDicts
|
||||
);
|
||||
vtfs.set(sendProc, new PtrList<volTensorField>(0));
|
||||
receiveFields<volTensorField>
|
||||
(
|
||||
sendProc,
|
||||
allFieldNames,
|
||||
domainMesh,
|
||||
vtfs[sendProc],
|
||||
fieldDicts
|
||||
);
|
||||
#undef doLocalCode
|
||||
#define doLocalCode(FieldType, Variable) \
|
||||
receiveFields<FieldType> \
|
||||
( \
|
||||
sendProc, \
|
||||
allFieldNames, \
|
||||
domainMesh, \
|
||||
Variable.emplace_set(sendProc), \
|
||||
fieldDicts \
|
||||
)
|
||||
|
||||
// Surface fields
|
||||
ssfs.set(sendProc, new PtrList<surfaceScalarField>(0));
|
||||
receiveFields<surfaceScalarField>
|
||||
(
|
||||
sendProc,
|
||||
allFieldNames,
|
||||
domainMesh,
|
||||
ssfs[sendProc],
|
||||
fieldDicts
|
||||
);
|
||||
svfs.set(sendProc, new PtrList<surfaceVectorField>(0));
|
||||
receiveFields<surfaceVectorField>
|
||||
(
|
||||
sendProc,
|
||||
allFieldNames,
|
||||
domainMesh,
|
||||
svfs[sendProc],
|
||||
fieldDicts
|
||||
);
|
||||
ssptfs.set
|
||||
(
|
||||
sendProc,
|
||||
new PtrList<surfaceSphericalTensorField>(0)
|
||||
);
|
||||
receiveFields<surfaceSphericalTensorField>
|
||||
(
|
||||
sendProc,
|
||||
allFieldNames,
|
||||
domainMesh,
|
||||
ssptfs[sendProc],
|
||||
fieldDicts
|
||||
);
|
||||
ssytfs.set(sendProc, new PtrList<surfaceSymmTensorField>(0));
|
||||
receiveFields<surfaceSymmTensorField>
|
||||
(
|
||||
sendProc,
|
||||
allFieldNames,
|
||||
domainMesh,
|
||||
ssytfs[sendProc],
|
||||
fieldDicts
|
||||
);
|
||||
stfs.set(sendProc, new PtrList<surfaceTensorField>(0));
|
||||
receiveFields<surfaceTensorField>
|
||||
(
|
||||
sendProc,
|
||||
allFieldNames,
|
||||
domainMesh,
|
||||
stfs[sendProc],
|
||||
fieldDicts
|
||||
);
|
||||
// Volume Fields
|
||||
doLocalCode(volScalarField, vsfs);
|
||||
doLocalCode(volVectorField, vvfs);
|
||||
doLocalCode(volSphericalTensorField, vsptfs);
|
||||
doLocalCode(volSymmTensorField, vsytfs);
|
||||
doLocalCode(volTensorField, vtfs);
|
||||
|
||||
// Dimensioned fields
|
||||
dsfs.set
|
||||
(
|
||||
sendProc,
|
||||
new PtrList<volScalarField::Internal>(0)
|
||||
);
|
||||
receiveFields<volScalarField::Internal>
|
||||
(
|
||||
sendProc,
|
||||
allFieldNames,
|
||||
domainMesh,
|
||||
dsfs[sendProc],
|
||||
fieldDicts
|
||||
);
|
||||
dvfs.set
|
||||
(
|
||||
sendProc,
|
||||
new PtrList<volVectorField::Internal>(0)
|
||||
);
|
||||
receiveFields<volVectorField::Internal>
|
||||
(
|
||||
sendProc,
|
||||
allFieldNames,
|
||||
domainMesh,
|
||||
dvfs[sendProc],
|
||||
fieldDicts
|
||||
);
|
||||
dstfs.set
|
||||
(
|
||||
sendProc,
|
||||
new PtrList<volSphericalTensorField::Internal>(0)
|
||||
);
|
||||
receiveFields<volSphericalTensorField::Internal>
|
||||
(
|
||||
sendProc,
|
||||
allFieldNames,
|
||||
domainMesh,
|
||||
dstfs[sendProc],
|
||||
fieldDicts
|
||||
);
|
||||
dsytfs.set
|
||||
(
|
||||
sendProc,
|
||||
new PtrList<volSymmTensorField::Internal>(0)
|
||||
);
|
||||
receiveFields<volSymmTensorField::Internal>
|
||||
(
|
||||
sendProc,
|
||||
allFieldNames,
|
||||
domainMesh,
|
||||
dsytfs[sendProc],
|
||||
fieldDicts
|
||||
);
|
||||
dtfs.set
|
||||
(
|
||||
sendProc,
|
||||
new PtrList<volTensorField::Internal>(0)
|
||||
);
|
||||
receiveFields<volTensorField::Internal>
|
||||
(
|
||||
sendProc,
|
||||
allFieldNames,
|
||||
domainMesh,
|
||||
dtfs[sendProc],
|
||||
fieldDicts
|
||||
);
|
||||
// Surface Fields
|
||||
doLocalCode(surfaceScalarField, ssfs);
|
||||
doLocalCode(surfaceVectorField, svfs);
|
||||
doLocalCode(surfaceSphericalTensorField, ssptfs);
|
||||
doLocalCode(surfaceSymmTensorField, ssytfs);
|
||||
doLocalCode(surfaceTensorField, stfs);
|
||||
|
||||
// Dimensioned Fields
|
||||
doLocalCode(volScalarField::Internal, dsfs);
|
||||
doLocalCode(volVectorField::Internal, dvfs);
|
||||
doLocalCode(volSphericalTensorField::Internal, dsptfs);
|
||||
doLocalCode(volSymmTensorField::Internal, dsytfs);
|
||||
doLocalCode(volTensorField::Internal, dtfs);
|
||||
|
||||
#undef doLocalCode
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2796,33 +2626,25 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
|
||||
// 'Receive' from myself
|
||||
{
|
||||
meshes.set(Pstream::myProcNo(), &mesh_);
|
||||
fvMeshes.set(Pstream::myProcNo(), &mesh_);
|
||||
meshes.set(UPstream::myProcNo(), &mesh_);
|
||||
fvMeshes.set(UPstream::myProcNo(), &mesh_);
|
||||
|
||||
//domainSourceFaces.set(Pstream::myProcNo(), std::move(sourceFace));
|
||||
domainSourceFaces.set(Pstream::myProcNo(), new labelList(0));
|
||||
domainSourceFaces[Pstream::myProcNo()] = sourceFace;
|
||||
domainSourceFaces.emplace_set(UPstream::myProcNo()) = sourceFace;
|
||||
domainSourceProcs.emplace_set(UPstream::myProcNo()) = sourceProc;
|
||||
domainSourcePatchs.emplace_set(UPstream::myProcNo()) = sourcePatch;
|
||||
|
||||
domainSourceProcs.set(Pstream::myProcNo(), new labelList(0));
|
||||
//std::move(sourceProc));
|
||||
domainSourceProcs[Pstream::myProcNo()] = sourceProc;
|
||||
domainSourceNewNbrProcs.emplace_set(UPstream::myProcNo()) =
|
||||
sourceNewNbrProc;
|
||||
|
||||
domainSourcePatchs.set(Pstream::myProcNo(), new labelList(0));
|
||||
//, std::move(sourcePatch));
|
||||
domainSourcePatchs[Pstream::myProcNo()] = sourcePatch;
|
||||
|
||||
domainSourceNewNbrProcs.set(Pstream::myProcNo(), new labelList(0));
|
||||
domainSourceNewNbrProcs[Pstream::myProcNo()] = sourceNewNbrProc;
|
||||
|
||||
domainSourcePointMasters.set(Pstream::myProcNo(), new labelList(0));
|
||||
domainSourcePointMasters[Pstream::myProcNo()] = sourcePointMaster;
|
||||
domainSourcePointMasters.emplace_set(UPstream::myProcNo()) =
|
||||
sourcePointMaster;
|
||||
}
|
||||
|
||||
|
||||
// Find matching faces that need to be stitched
|
||||
labelListList localBoundaryFace(Pstream::nProcs());
|
||||
labelListList remoteFaceProc(Pstream::nProcs());
|
||||
labelListList remoteBoundaryFace(Pstream::nProcs());
|
||||
labelListList localBoundaryFace(UPstream::nProcs());
|
||||
labelListList remoteFaceProc(UPstream::nProcs());
|
||||
labelListList remoteBoundaryFace(UPstream::nProcs());
|
||||
findCouples
|
||||
(
|
||||
meshes,
|
||||
@ -2887,15 +2709,15 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
|
||||
{
|
||||
//- Combine sourceProc, sourcePatch, sourceFace
|
||||
sourceProc.setSize(mesh_.nBoundaryFaces());
|
||||
sourceProc.resize_nocopy(mesh_.nBoundaryFaces());
|
||||
sourceProc = -1;
|
||||
sourcePatch.setSize(mesh_.nBoundaryFaces());
|
||||
sourcePatch.resize_nocopy(mesh_.nBoundaryFaces());
|
||||
sourcePatch = -1;
|
||||
sourceFace.setSize(mesh_.nBoundaryFaces());
|
||||
sourceFace.resize_nocopy(mesh_.nBoundaryFaces());
|
||||
sourceFace = -1;
|
||||
sourceNewNbrProc.setSize(mesh_.nBoundaryFaces());
|
||||
sourceNewNbrProc.resize_nocopy(mesh_.nBoundaryFaces());
|
||||
sourceNewNbrProc = -1;
|
||||
sourcePointMaster.setSize(mesh_.nPoints());
|
||||
sourcePointMaster.resize_nocopy(mesh_.nPoints());
|
||||
sourcePointMaster = -1;
|
||||
|
||||
if (mesh_.nPoints() > 0)
|
||||
|
||||
@ -402,7 +402,7 @@ public:
|
||||
static void printFieldInfo(const fvMesh&);
|
||||
|
||||
//- Print some info on mesh.
|
||||
static void printMeshInfo(const fvMesh&);
|
||||
static void printMeshInfo(const polyMesh&);
|
||||
|
||||
//- Generate a test field on faces
|
||||
static tmp<surfaceScalarField> generateTestField(const fvMesh&);
|
||||
|
||||
@ -142,9 +142,11 @@ void Foam::fvPatchMapper::calcAddressing() const
|
||||
else
|
||||
{
|
||||
// Need to recalculate weights to exclude hits into internal
|
||||
labelList newAddr(curAddr.size(), false);
|
||||
labelList newAddr(curAddr.size());
|
||||
scalarField newWeights(curAddr.size());
|
||||
|
||||
label nActive = 0;
|
||||
scalar sumWeight = 0;
|
||||
|
||||
forAll(curAddr, lfI)
|
||||
{
|
||||
@ -156,17 +158,19 @@ void Foam::fvPatchMapper::calcAddressing() const
|
||||
{
|
||||
newAddr[nActive] = curAddr[lfI] - oldPatchStart;
|
||||
newWeights[nActive] = curW[lfI];
|
||||
nActive++;
|
||||
|
||||
sumWeight += curW[lfI];
|
||||
++nActive;
|
||||
}
|
||||
}
|
||||
|
||||
newAddr.setSize(nActive);
|
||||
newWeights.setSize(nActive);
|
||||
newAddr.resize(nActive);
|
||||
newWeights.resize(nActive);
|
||||
|
||||
// Re-scale the weights
|
||||
if (nActive > 0)
|
||||
{
|
||||
newWeights /= sum(newWeights);
|
||||
newWeights /= sumWeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -87,31 +87,27 @@ Foam::functionObjects::fieldCoordinateSystemTransform::transformFieldName
|
||||
const Foam::surfaceTensorField&
|
||||
Foam::functionObjects::fieldCoordinateSystemTransform::srotTensor() const
|
||||
{
|
||||
typedef surfaceTensorField FieldType;
|
||||
typedef surfaceTensorField::Boundary BoundaryType;
|
||||
|
||||
if (!rotTensorSurface_)
|
||||
{
|
||||
tensorField rotations(csysPtr_->R(mesh_.faceCentres()));
|
||||
|
||||
rotTensorSurface_.reset
|
||||
(
|
||||
new FieldType
|
||||
rotTensorSurface_.emplace
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"surfRotation",
|
||||
mesh_.objectRegistry::instance(),
|
||||
mesh_.objectRegistry::db(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
IOobjectOption::NO_READ,
|
||||
IOobjectOption::NO_WRITE,
|
||||
IOobjectOption::NO_REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimless,
|
||||
std::move(rotations)
|
||||
// calculatedType
|
||||
)
|
||||
);
|
||||
|
||||
auto& rot = *rotTensorSurface_;
|
||||
@ -132,31 +128,27 @@ Foam::functionObjects::fieldCoordinateSystemTransform::srotTensor() const
|
||||
const Foam::volTensorField&
|
||||
Foam::functionObjects::fieldCoordinateSystemTransform::vrotTensor() const
|
||||
{
|
||||
typedef volTensorField FieldType;
|
||||
typedef volTensorField::Boundary BoundaryType;
|
||||
|
||||
if (!rotTensorVolume_)
|
||||
{
|
||||
tensorField rotations(csysPtr_->R(mesh_.cellCentres()));
|
||||
|
||||
rotTensorVolume_.reset
|
||||
(
|
||||
new FieldType
|
||||
rotTensorVolume_.emplace
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"volRotation",
|
||||
mesh_.objectRegistry::instance(),
|
||||
mesh_.objectRegistry::db(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
IOobjectOption::NO_READ,
|
||||
IOobjectOption::NO_WRITE,
|
||||
IOobjectOption::NO_REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimless,
|
||||
std::move(rotations)
|
||||
// calculatedType
|
||||
)
|
||||
);
|
||||
|
||||
auto& rot = *rotTensorVolume_;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -85,29 +85,30 @@ void Foam::areaWrite::performAction
|
||||
Info<< "write: " << fieldName << endl;
|
||||
}
|
||||
|
||||
refPtr<GeoField> tfield;
|
||||
|
||||
if (loadFromFiles_)
|
||||
{
|
||||
const GeoField fld
|
||||
tfield.emplace
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldName,
|
||||
time_.timeName(),
|
||||
areaMesh.thisDb(),
|
||||
IOobject::MUST_READ
|
||||
IOobjectOption::MUST_READ,
|
||||
IOobjectOption::NO_WRITE,
|
||||
IOobjectOption::NO_REGISTER
|
||||
),
|
||||
areaMesh
|
||||
);
|
||||
|
||||
writeSurface(writer, &fld, fieldName);
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto* fieldPtr =
|
||||
areaMesh.thisDb().cfindObject<GeoField>(fieldName);
|
||||
|
||||
writeSurface(writer, fieldPtr, fieldName);
|
||||
tfield.cref(areaMesh.thisDb().cfindObject<GeoField>(fieldName));
|
||||
}
|
||||
|
||||
writeSurface(writer, tfield.get(), fieldName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2377,13 +2377,12 @@ Foam::label Foam::meshRefinement::appendPatch
|
||||
const_cast<polyBoundaryMesh&>(mesh.boundaryMesh());
|
||||
fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh.boundary());
|
||||
|
||||
label patchi = polyPatches.size();
|
||||
// The new location (at the end)
|
||||
const label patchi = polyPatches.size();
|
||||
|
||||
// Add polyPatch at the end
|
||||
polyPatches.setSize(patchi+1);
|
||||
polyPatches.set
|
||||
polyPatches.push_back
|
||||
(
|
||||
patchi,
|
||||
polyPatch::New
|
||||
(
|
||||
patchName,
|
||||
@ -2392,10 +2391,9 @@ Foam::label Foam::meshRefinement::appendPatch
|
||||
polyPatches
|
||||
)
|
||||
);
|
||||
fvPatches.setSize(patchi+1);
|
||||
fvPatches.set
|
||||
|
||||
fvPatches.push_back
|
||||
(
|
||||
patchi,
|
||||
fvPatch::New
|
||||
(
|
||||
polyPatches[patchi], // point to newly added polyPatch
|
||||
@ -2678,17 +2676,12 @@ Foam::label Foam::meshRefinement::addPointZone(const word& name)
|
||||
{
|
||||
zoneI = pointZones.size();
|
||||
pointZones.clearAddressing();
|
||||
pointZones.setSize(zoneI+1);
|
||||
pointZones.set
|
||||
(
|
||||
zoneI,
|
||||
new pointZone
|
||||
|
||||
pointZones.emplace_back
|
||||
(
|
||||
name, // name
|
||||
labelList(0), // addressing
|
||||
zoneI, // index
|
||||
pointZones // pointZoneMesh
|
||||
)
|
||||
);
|
||||
}
|
||||
return zoneI;
|
||||
|
||||
@ -1526,18 +1526,12 @@ void Foam::meshRefinement::selectIntersectedFaces
|
||||
// if (zonei == -1)
|
||||
// {
|
||||
// zonei = faceZones.size();
|
||||
// faceZones.setSize(zonei+1);
|
||||
// faceZones.set
|
||||
// (
|
||||
// zonei,
|
||||
// new faceZone
|
||||
//
|
||||
// faceZones.emplace_back
|
||||
// (
|
||||
// "frozenFaces", // name
|
||||
// labelList(0), // addressing
|
||||
// boolList(0), // flip
|
||||
// zonei, // index
|
||||
// faceZones // faceZoneMesh
|
||||
// )
|
||||
// faceZones
|
||||
// );
|
||||
// }
|
||||
//
|
||||
@ -1653,17 +1647,13 @@ void Foam::meshRefinement::selectIntersectedFaces
|
||||
// // if (zonei == -1)
|
||||
// // {
|
||||
// // zonei = pointZones.size();
|
||||
// // pointZones.setSize(zonei+1);
|
||||
// // pointZones.set
|
||||
// // (
|
||||
// // zonei,
|
||||
// // new pointZone
|
||||
// //
|
||||
// // pointZones.emplace_back
|
||||
// // (
|
||||
// // "frozenPoints", // name
|
||||
// // isFrozenPoint.sortedToc(), // addressing
|
||||
// // zonei, // index
|
||||
// // pointZones // pointZoneMesh
|
||||
// // )
|
||||
// // );
|
||||
// // }
|
||||
// //}
|
||||
|
||||
@ -432,25 +432,22 @@ Foam::label Foam::surfaceZonesInfo::addCellZone
|
||||
{
|
||||
cellZoneMesh& cellZones = mesh.cellZones();
|
||||
|
||||
label zoneI = cellZones.findZoneID(name);
|
||||
label zoneID = cellZones.findZoneID(name);
|
||||
|
||||
if (zoneI == -1)
|
||||
if (zoneID == -1)
|
||||
{
|
||||
zoneI = cellZones.size();
|
||||
cellZones.setSize(zoneI+1);
|
||||
cellZones.set
|
||||
zoneID = cellZones.size();
|
||||
|
||||
cellZones.emplace_back
|
||||
(
|
||||
zoneI,
|
||||
new cellZone
|
||||
(
|
||||
name, // name
|
||||
addressing, // addressing
|
||||
zoneI, // index
|
||||
cellZones // cellZoneMesh
|
||||
)
|
||||
name,
|
||||
addressing,
|
||||
zoneID,
|
||||
cellZones
|
||||
);
|
||||
}
|
||||
return zoneI;
|
||||
|
||||
return zoneID;
|
||||
}
|
||||
|
||||
|
||||
@ -474,7 +471,7 @@ Foam::labelList Foam::surfaceZonesInfo::addCellZonesToMesh
|
||||
label zoneI = addCellZone
|
||||
(
|
||||
cellZoneName,
|
||||
labelList(0), // addressing
|
||||
labelList(), // addressing
|
||||
mesh
|
||||
);
|
||||
|
||||
@ -515,24 +512,19 @@ Foam::label Foam::surfaceZonesInfo::addFaceZone
|
||||
{
|
||||
faceZoneMesh& faceZones = mesh.faceZones();
|
||||
|
||||
label zoneI = faceZones.findZoneID(name);
|
||||
label zoneID = faceZones.findZoneID(name);
|
||||
|
||||
if (zoneI == -1)
|
||||
if (zoneID == -1)
|
||||
{
|
||||
zoneI = faceZones.size();
|
||||
faceZones.setSize(zoneI+1);
|
||||
zoneID = faceZones.size();
|
||||
|
||||
faceZones.set
|
||||
faceZones.emplace_back
|
||||
(
|
||||
zoneI,
|
||||
new faceZone
|
||||
(
|
||||
name, // name
|
||||
addressing, // addressing
|
||||
flipMap, // flipMap
|
||||
zoneI, // index
|
||||
faceZones // faceZoneMesh
|
||||
)
|
||||
name,
|
||||
addressing,
|
||||
flipMap,
|
||||
zoneID,
|
||||
faceZones
|
||||
);
|
||||
}
|
||||
// else
|
||||
@ -604,7 +596,8 @@ Foam::label Foam::surfaceZonesInfo::addFaceZone
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return zoneI;
|
||||
|
||||
return zoneID;
|
||||
}
|
||||
|
||||
|
||||
@ -633,8 +626,8 @@ Foam::labelListList Foam::surfaceZonesInfo::addFaceZonesToMesh
|
||||
label zoneI = addFaceZone
|
||||
(
|
||||
faceZoneName, //name
|
||||
labelList(0), //addressing
|
||||
boolList(0), //flipmap
|
||||
labelList(), //addressing
|
||||
boolList(), //flipmap
|
||||
mesh
|
||||
);
|
||||
|
||||
|
||||
@ -246,17 +246,12 @@ bool Foam::cellZoneSet::writeObject
|
||||
{
|
||||
zoneID = cellZones.size();
|
||||
|
||||
cellZones.setSize(zoneID+1);
|
||||
cellZones.set
|
||||
(
|
||||
zoneID,
|
||||
new cellZone
|
||||
cellZones.emplace_back
|
||||
(
|
||||
name(),
|
||||
addressing_,
|
||||
zoneID,
|
||||
cellZones
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
|
||||
@ -462,18 +462,13 @@ bool Foam::faceZoneSet::writeObject
|
||||
{
|
||||
zoneID = faceZones.size();
|
||||
|
||||
faceZones.setSize(zoneID+1);
|
||||
faceZones.set
|
||||
(
|
||||
zoneID,
|
||||
new faceZone
|
||||
faceZones.emplace_back
|
||||
(
|
||||
name(),
|
||||
addressing_,
|
||||
flipMap_,
|
||||
zoneID,
|
||||
faceZones
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
|
||||
@ -246,17 +246,12 @@ bool Foam::pointZoneSet::writeObject
|
||||
{
|
||||
zoneID = pointZones.size();
|
||||
|
||||
pointZones.setSize(zoneID+1);
|
||||
pointZones.set
|
||||
(
|
||||
zoneID,
|
||||
new pointZone
|
||||
pointZones.emplace_back
|
||||
(
|
||||
name(),
|
||||
addressing_,
|
||||
zoneID,
|
||||
pointZones
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
|
||||
@ -45,18 +45,12 @@ void Foam::lagrangianFieldDecomposer::readFields
|
||||
lagrangianObjects.sorted<IOField<Type>>()
|
||||
);
|
||||
|
||||
lagrangianFields.set
|
||||
(
|
||||
cloudi,
|
||||
new PtrList<IOField<Type>>(fieldObjects.size())
|
||||
);
|
||||
auto& cloudFields =
|
||||
lagrangianFields.emplace_set(cloudi, fieldObjects.size());
|
||||
|
||||
|
||||
label fieldi = 0;
|
||||
|
||||
for (const IOobject& io : fieldObjects)
|
||||
forAll(fieldObjects, fieldi)
|
||||
{
|
||||
lagrangianFields[cloudi].set(fieldi++, new IOField<Type>(io));
|
||||
cloudFields.emplace_set(fieldi, fieldObjects[fieldi]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,14 +64,12 @@ void Foam::lagrangianFieldDecomposer::readFieldFields
|
||||
)
|
||||
{
|
||||
// List of lagrangian field objects
|
||||
UPtrList<const IOobject> fieldObjects;
|
||||
|
||||
fieldObjects.append
|
||||
UPtrList<const IOobject> fieldObjects
|
||||
(
|
||||
lagrangianObjects.sorted<IOField<Field<Type>>>()
|
||||
);
|
||||
|
||||
fieldObjects.append
|
||||
fieldObjects.push_back
|
||||
(
|
||||
lagrangianObjects.sorted<CompactIOField<Field<Type>, Type>>()
|
||||
);
|
||||
@ -85,22 +77,12 @@ void Foam::lagrangianFieldDecomposer::readFieldFields
|
||||
Foam::sort(fieldObjects, nameOp<IOobject>());
|
||||
|
||||
|
||||
lagrangianFields.set
|
||||
(
|
||||
cloudi,
|
||||
new PtrList<CompactIOField<Field<Type>, Type>>(fieldObjects.size())
|
||||
);
|
||||
auto& cloudFields =
|
||||
lagrangianFields.emplace_set(cloudi, fieldObjects.size());
|
||||
|
||||
|
||||
label fieldi = 0;
|
||||
|
||||
for (const IOobject& io : fieldObjects)
|
||||
forAll(fieldObjects, fieldi)
|
||||
{
|
||||
lagrangianFields[cloudi].set
|
||||
(
|
||||
fieldi++,
|
||||
new CompactIOField<Field<Type>, Type>(io)
|
||||
);
|
||||
cloudFields.emplace_set(fieldi, fieldObjects[fieldi]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
Copyright (C) 2022-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -34,9 +34,20 @@ License
|
||||
|
||||
void Foam::processorFaMeshes::read()
|
||||
{
|
||||
// Make sure to clear (and hence unregister) any previously loaded meshes
|
||||
// and fields
|
||||
|
||||
boundaryProcAddressing_.free();
|
||||
faceProcAddressing_.free();
|
||||
edgeProcAddressing_.free();
|
||||
pointProcAddressing_.free();
|
||||
meshes_.free();
|
||||
|
||||
|
||||
forAll(fvMeshes_, proci)
|
||||
{
|
||||
meshes_.set(proci, new faMesh(fvMeshes_[proci]));
|
||||
// Construct from polyMesh IO information
|
||||
meshes_.emplace_set(proci, fvMeshes_[proci]);
|
||||
|
||||
// Read the addressing information
|
||||
|
||||
@ -46,8 +57,8 @@ void Foam::processorFaMeshes::read()
|
||||
"constant", // Placeholder
|
||||
faMesh::meshSubDir,
|
||||
meshes_[proci].thisDb(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobjectOption::MUST_READ,
|
||||
IOobjectOption::NO_WRITE
|
||||
);
|
||||
|
||||
const auto& runTime = meshes_[proci].thisDb().time();
|
||||
@ -56,22 +67,22 @@ void Foam::processorFaMeshes::read()
|
||||
// pointProcAddressing (faMesh)
|
||||
ioAddr.rename("pointProcAddressing");
|
||||
ioAddr.instance() = runTime.findInstance(meshDir, ioAddr.name());
|
||||
pointProcAddressing_.set(proci, new labelIOList(ioAddr));
|
||||
pointProcAddressing_.emplace_set(proci, ioAddr);
|
||||
|
||||
// edgeProcAddressing (faMesh)
|
||||
ioAddr.rename("edgeProcAddressing");
|
||||
ioAddr.instance() = runTime.findInstance(meshDir, ioAddr.name());
|
||||
edgeProcAddressing_.set(proci, new labelIOList(ioAddr));
|
||||
edgeProcAddressing_.emplace_set(proci, ioAddr);
|
||||
|
||||
// faceProcAddressing (faMesh)
|
||||
ioAddr.rename("faceProcAddressing");
|
||||
ioAddr.instance() = runTime.findInstance(meshDir, ioAddr.name());
|
||||
faceProcAddressing_.set(proci, new labelIOList(ioAddr));
|
||||
faceProcAddressing_.emplace_set(proci, ioAddr);
|
||||
|
||||
// boundaryProcAddressing (faMesh)
|
||||
ioAddr.rename("boundaryProcAddressing");
|
||||
ioAddr.instance() = runTime.findInstance(meshDir, ioAddr.name());
|
||||
boundaryProcAddressing_.set(proci, new labelIOList(ioAddr));
|
||||
boundaryProcAddressing_.emplace_set(proci, ioAddr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -46,29 +46,23 @@ void Foam::processorMeshes::read()
|
||||
{
|
||||
// Make sure to clear (and hence unregister) any previously loaded meshes
|
||||
// and fields
|
||||
forAll(databases_, proci)
|
||||
{
|
||||
boundaryProcAddressing_.set(proci, nullptr);
|
||||
cellProcAddressing_.set(proci, nullptr);
|
||||
faceProcAddressing_.set(proci, nullptr);
|
||||
pointProcAddressing_.set(proci, nullptr);
|
||||
meshes_.set(proci, nullptr);
|
||||
}
|
||||
boundaryProcAddressing_.free();
|
||||
cellProcAddressing_.free();
|
||||
faceProcAddressing_.free();
|
||||
pointProcAddressing_.free();
|
||||
meshes_.free();
|
||||
|
||||
forAll(databases_, proci)
|
||||
{
|
||||
meshes_.set
|
||||
meshes_.emplace_set
|
||||
(
|
||||
proci,
|
||||
new fvMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
meshName_,
|
||||
databases_[proci].timeName(),
|
||||
databases_[proci]
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Read the addressing information
|
||||
@ -79,25 +73,25 @@ void Foam::processorMeshes::read()
|
||||
meshes_[proci].facesInstance(),
|
||||
polyMesh::meshSubDir,
|
||||
meshes_[proci].thisDb(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobjectOption::MUST_READ,
|
||||
IOobjectOption::NO_WRITE
|
||||
);
|
||||
|
||||
// pointProcAddressing (polyMesh)
|
||||
ioAddr.rename("pointProcAddressing");
|
||||
pointProcAddressing_.set(proci, new labelIOList(ioAddr));
|
||||
pointProcAddressing_.emplace_set(proci, ioAddr);
|
||||
|
||||
// faceProcAddressing (polyMesh)
|
||||
ioAddr.rename("faceProcAddressing");
|
||||
faceProcAddressing_.set(proci, new labelIOList(ioAddr));
|
||||
faceProcAddressing_.emplace_set(proci, ioAddr);
|
||||
|
||||
// cellProcAddressing (polyMesh)
|
||||
ioAddr.rename("cellProcAddressing");
|
||||
cellProcAddressing_.set(proci, new labelIOList(ioAddr));
|
||||
cellProcAddressing_.emplace_set(proci, ioAddr);
|
||||
|
||||
// boundaryProcAddressing (polyMesh)
|
||||
ioAddr.rename("boundaryProcAddressing");
|
||||
boundaryProcAddressing_.set(proci, new labelIOList(ioAddr));
|
||||
boundaryProcAddressing_.emplace_set(proci, ioAddr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -72,26 +72,22 @@ Foam::probes::getOrLoadField(const word& fieldName) const
|
||||
|
||||
if (loadFromFiles_)
|
||||
{
|
||||
tfield.reset
|
||||
(
|
||||
new GeoField
|
||||
tfield.emplace
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldName,
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
mesh_.thisDb(),
|
||||
IOobjectOption::MUST_READ,
|
||||
IOobjectOption::NO_WRITE,
|
||||
IOobjectOption::NO_REGISTER
|
||||
),
|
||||
mesh_
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Slightly paranoid here
|
||||
tfield.cref(mesh_.cfindObject<GeoField>(fieldName));
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -42,26 +42,22 @@ Foam::sampledSets::getOrLoadField(const word& fieldName) const
|
||||
|
||||
if (loadFromFiles_)
|
||||
{
|
||||
tfield.reset
|
||||
(
|
||||
new GeoField
|
||||
tfield.emplace
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldName,
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
mesh_.thisDb(),
|
||||
IOobjectOption::MUST_READ,
|
||||
IOobjectOption::NO_WRITE,
|
||||
IOobjectOption::NO_REGISTER
|
||||
),
|
||||
mesh_
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Slightly paranoid here
|
||||
tfield.cref(mesh_.cfindObject<GeoField>(fieldName));
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -220,29 +220,32 @@ void Foam::sampledSurfaces::performAction
|
||||
Info<< "sampleWrite: " << fieldName << endl;
|
||||
}
|
||||
|
||||
refPtr<GeoField> tfield;
|
||||
|
||||
if (loadFromFiles_)
|
||||
{
|
||||
const GeoField fld
|
||||
tfield.emplace
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldName,
|
||||
time_.timeName(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ
|
||||
mesh_.thisDb(),
|
||||
IOobjectOption::MUST_READ,
|
||||
IOobjectOption::NO_WRITE,
|
||||
IOobjectOption::NO_REGISTER
|
||||
),
|
||||
mesh_
|
||||
);
|
||||
|
||||
performAction(fld, request);
|
||||
}
|
||||
else
|
||||
{
|
||||
performAction
|
||||
(
|
||||
mesh_.thisDb().lookupObject<GeoField>(fieldName),
|
||||
request
|
||||
);
|
||||
tfield.cref(mesh_.thisDb().cfindObject<GeoField>(fieldName));
|
||||
}
|
||||
|
||||
if (tfield)
|
||||
{
|
||||
performAction(tfield(), request);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -946,9 +946,9 @@ void Foam::isoSurfaceCell::calcAddressing
|
||||
|
||||
|
||||
// Determine edgeFaces
|
||||
edgeFace0.resize(nUnique);
|
||||
edgeFace0.resize_nocopy(nUnique);
|
||||
edgeFace0 = -1;
|
||||
edgeFace1.resize(nUnique);
|
||||
edgeFace1.resize_nocopy(nUnique);
|
||||
edgeFace1 = -1;
|
||||
edgeFacesRest.clear();
|
||||
|
||||
@ -972,19 +972,8 @@ void Foam::isoSurfaceCell::calcAddressing
|
||||
// << " used by more than two triangles: " << edgeFace0[edgeI]
|
||||
// << ", "
|
||||
// << edgeFace1[edgeI] << " and " << triI << endl;
|
||||
Map<labelList>::iterator iter = edgeFacesRest.find(edgeI);
|
||||
|
||||
if (iter != edgeFacesRest.end())
|
||||
{
|
||||
labelList& eFaces = iter();
|
||||
label sz = eFaces.size();
|
||||
eFaces.setSize(sz+1);
|
||||
eFaces[sz] = triI;
|
||||
}
|
||||
else
|
||||
{
|
||||
edgeFacesRest.insert(edgeI, labelList(1, triI));
|
||||
}
|
||||
edgeFacesRest(edgeI).push_back(triI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1406,9 +1406,9 @@ Foam::isoSurfacePoint::isoSurfacePoint
|
||||
);
|
||||
|
||||
// Clear old value. Cannot resize it since is a slice.
|
||||
bfld.set(patchi, nullptr);
|
||||
|
||||
// Set new value we can change
|
||||
|
||||
bfld.release(patchi);
|
||||
bfld.set
|
||||
(
|
||||
patchi,
|
||||
|
||||
@ -75,9 +75,9 @@ Foam::isoSurfacePoint::adaptPatchFields
|
||||
)
|
||||
{
|
||||
// Clear old value. Cannot resize it since is a slice.
|
||||
sliceFldBf.set(patchi, nullptr);
|
||||
|
||||
// Set new value we can change
|
||||
|
||||
sliceFldBf.release(patchi);
|
||||
sliceFldBf.set
|
||||
(
|
||||
patchi,
|
||||
|
||||
Reference in New Issue
Block a user