mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
using .xfer() method instead of xferMoveTo<...> in a few places
This commit is contained in:
@ -23,7 +23,7 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Description
|
Description
|
||||||
UNIX versions of the functions declated in OSspecific.H.
|
UNIX versions of the functions declared in OSspecific.H.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|||||||
@ -155,6 +155,13 @@ Field<Type>::Field(Field<Type>& f, bool reUse)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Field<Type>::Field(const Xfer<List<Type> >& f)
|
||||||
|
:
|
||||||
|
List<Type>(f)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Field<Type>::Field(const Xfer<Field<Type> >& f)
|
Field<Type>::Field(const Xfer<Field<Type> >& f)
|
||||||
:
|
:
|
||||||
|
|||||||
@ -114,6 +114,9 @@ public:
|
|||||||
//- Construct as copy of a UList<Type>
|
//- Construct as copy of a UList<Type>
|
||||||
explicit Field(const UList<Type>&);
|
explicit Field(const UList<Type>&);
|
||||||
|
|
||||||
|
//- Construct by transferring the List contents
|
||||||
|
explicit Field(const Xfer<List<Type> >&);
|
||||||
|
|
||||||
//- Construct by 1 to 1 mapping from the given field
|
//- Construct by 1 to 1 mapping from the given field
|
||||||
Field
|
Field
|
||||||
(
|
(
|
||||||
|
|||||||
@ -2952,9 +2952,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChange::changeMesh
|
|||||||
mesh.resetPrimitives
|
mesh.resetPrimitives
|
||||||
(
|
(
|
||||||
xferMove(renumberedMeshPoints),
|
xferMove(renumberedMeshPoints),
|
||||||
xferMoveTo<faceList>(faces_),
|
faces_.xfer(),
|
||||||
xferMoveTo<labelList>(faceOwner_),
|
faceOwner_.xfer(),
|
||||||
xferMoveTo<labelList>(faceNeighbour_),
|
faceNeighbour_.xfer(),
|
||||||
patchSizes,
|
patchSizes,
|
||||||
patchStarts,
|
patchStarts,
|
||||||
syncParallel
|
syncParallel
|
||||||
@ -2968,9 +2968,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChange::changeMesh
|
|||||||
mesh.resetPrimitives
|
mesh.resetPrimitives
|
||||||
(
|
(
|
||||||
xferMove(newPoints),
|
xferMove(newPoints),
|
||||||
xferMoveTo<faceList>(faces_),
|
faces_.xfer(),
|
||||||
xferMoveTo<labelList>(faceOwner_),
|
faceOwner_.xfer(),
|
||||||
xferMoveTo<labelList>(faceNeighbour_),
|
faceNeighbour_.xfer(),
|
||||||
patchSizes,
|
patchSizes,
|
||||||
patchStarts,
|
patchStarts,
|
||||||
syncParallel
|
syncParallel
|
||||||
@ -3195,9 +3195,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChange::makeMesh
|
|||||||
(
|
(
|
||||||
io,
|
io,
|
||||||
xferMove(newPoints),
|
xferMove(newPoints),
|
||||||
xferMoveTo<faceList>(faces_),
|
faces_.xfer(),
|
||||||
xferMoveTo<labelList>(faceOwner_),
|
faceOwner_.xfer(),
|
||||||
xferMoveTo<labelList>(faceNeighbour_)
|
faceNeighbour_.xfer()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
fvMesh& newMesh = newMeshPtr();
|
fvMesh& newMesh = newMeshPtr();
|
||||||
|
|||||||
@ -803,8 +803,8 @@ Foam::surfaceIntersection::surfaceIntersection
|
|||||||
|
|
||||||
// Transfer to straight label(List)List
|
// Transfer to straight label(List)List
|
||||||
transfer(edgeCuts2, surf2EdgeCuts_);
|
transfer(edgeCuts2, surf2EdgeCuts_);
|
||||||
transfer(allCutEdges, cutEdges_);
|
cutEdges_.transfer(allCutEdges);
|
||||||
transfer(allCutPoints, cutPoints_);
|
cutPoints_.transfer(allCutPoints);
|
||||||
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
@ -936,8 +936,8 @@ Foam::surfaceIntersection::surfaceIntersection
|
|||||||
|
|
||||||
|
|
||||||
// Transfer to straight label(List)List
|
// Transfer to straight label(List)List
|
||||||
transfer(allCutEdges, cutEdges_);
|
cutEdges_.transfer(allCutEdges);
|
||||||
transfer(allCutPoints, cutPoints_);
|
cutPoints_.transfer(allCutPoints);
|
||||||
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
@ -1040,8 +1040,8 @@ Foam::surfaceIntersection::surfaceIntersection
|
|||||||
|
|
||||||
// Transfer to straight label(List)List
|
// Transfer to straight label(List)List
|
||||||
transfer(edgeCuts1, surf1EdgeCuts_);
|
transfer(edgeCuts1, surf1EdgeCuts_);
|
||||||
transfer(allCutEdges, cutEdges_);
|
cutEdges_.transfer(allCutEdges);
|
||||||
transfer(allCutPoints, cutPoints_);
|
cutPoints_.transfer(allCutPoints);
|
||||||
|
|
||||||
// Shortcut.
|
// Shortcut.
|
||||||
if (cutPoints_.empty() && cutEdges_.empty())
|
if (cutPoints_.empty() && cutEdges_.empty())
|
||||||
|
|||||||
@ -120,10 +120,6 @@ class surfaceIntersection
|
|||||||
Ostream&
|
Ostream&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Transfer contents of DynamicList to straight List
|
|
||||||
template<class T>
|
|
||||||
static void transfer(DynamicList<T>&, List<T>&);
|
|
||||||
|
|
||||||
//- Transfer contents of List<DynamicList<..> > to List<List<..>>
|
//- Transfer contents of List<DynamicList<..> > to List<List<..>>
|
||||||
template<class T>
|
template<class T>
|
||||||
static void transfer(List<DynamicList<T> >&, List<List<T> >&);
|
static void transfer(List<DynamicList<T> >&, List<List<T> >&);
|
||||||
|
|||||||
@ -34,27 +34,15 @@ Description
|
|||||||
template<class T>
|
template<class T>
|
||||||
void Foam::surfaceIntersection::transfer
|
void Foam::surfaceIntersection::transfer
|
||||||
(
|
(
|
||||||
DynamicList<T>& dList,
|
List<DynamicList<T> >& srcLst,
|
||||||
List<T>& lList
|
List<List<T> >& dstLst
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
lList.transfer(dList);
|
dstLst.setSize(srcLst.size());
|
||||||
}
|
|
||||||
|
|
||||||
|
forAll(srcLst, elemI)
|
||||||
// Transfer contents of DynamicList to List
|
|
||||||
template<class T>
|
|
||||||
void Foam::surfaceIntersection::transfer
|
|
||||||
(
|
|
||||||
List<DynamicList<T> >& dList,
|
|
||||||
List<List<T> >& lList
|
|
||||||
)
|
|
||||||
{
|
|
||||||
lList.setSize(dList.size());
|
|
||||||
|
|
||||||
forAll(dList, elemI)
|
|
||||||
{
|
{
|
||||||
transfer(dList[elemI], lList[elemI]);
|
dstLst[elemI].transfer(srcLst[elemI]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -131,6 +131,29 @@ void Foam::BasicMeshedSurface<Face>::reset
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Face>
|
||||||
|
void Foam::BasicMeshedSurface<Face>::reset
|
||||||
|
(
|
||||||
|
const Xfer<List<point> >& pointLst,
|
||||||
|
const Xfer<List<Face> >& faceLst
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ParentType::clearOut();
|
||||||
|
|
||||||
|
// Take over new primitive data.
|
||||||
|
// Optimized to avoid overwriting data at all
|
||||||
|
if (&pointLst)
|
||||||
|
{
|
||||||
|
storedPoints().transfer(pointLst());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (&faceLst)
|
||||||
|
{
|
||||||
|
storedFaces().transfer(faceLst());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Remove badly degenerate faces, double faces.
|
// Remove badly degenerate faces, double faces.
|
||||||
template<class Face>
|
template<class Face>
|
||||||
void Foam::BasicMeshedSurface<Face>::cleanup(const bool verbose)
|
void Foam::BasicMeshedSurface<Face>::cleanup(const bool verbose)
|
||||||
|
|||||||
@ -138,6 +138,13 @@ public:
|
|||||||
const Xfer<List<Face> >&
|
const Xfer<List<Face> >&
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Transfer components (points, faces).
|
||||||
|
virtual void reset
|
||||||
|
(
|
||||||
|
const Xfer<List<point> >&,
|
||||||
|
const Xfer<List<Face> >&
|
||||||
|
);
|
||||||
|
|
||||||
//- Remove invalid faces
|
//- Remove invalid faces
|
||||||
virtual void cleanup(const bool verbose);
|
virtual void cleanup(const bool verbose);
|
||||||
|
|
||||||
|
|||||||
@ -62,7 +62,7 @@ bool Foam::MeshedSurface<Face>::read(Istream& is)
|
|||||||
surf.reset
|
surf.reset
|
||||||
(
|
(
|
||||||
Xfer<pointField>::null(),
|
Xfer<pointField>::null(),
|
||||||
xferMove(faceLst)
|
faceLst.xfer()
|
||||||
);
|
);
|
||||||
surf.addPatches(patches_);
|
surf.addPatches(patches_);
|
||||||
|
|
||||||
|
|||||||
@ -389,12 +389,7 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sortFacesAndStore
|
sortFacesAndStore(dynFaces.xfer(), dynRegions.xfer(), sorted);
|
||||||
(
|
|
||||||
xferMoveTo<List<Face> >(dynFaces),
|
|
||||||
xferMoveTo<List<label> >(dynRegions),
|
|
||||||
sorted
|
|
||||||
);
|
|
||||||
|
|
||||||
// add patches, culling empty groups
|
// add patches, culling empty groups
|
||||||
this->addPatches(dynSizes, names, true);
|
this->addPatches(dynSizes, names, true);
|
||||||
|
|||||||
@ -202,12 +202,7 @@ bool Foam::fileFormats::OBJsurfaceFormat<Face>::read
|
|||||||
// transfer to normal lists
|
// transfer to normal lists
|
||||||
this->storedPoints().transfer(dynPoints);
|
this->storedPoints().transfer(dynPoints);
|
||||||
|
|
||||||
sortFacesAndStore
|
sortFacesAndStore(dynFaces.xfer(), dynRegions.xfer(), sorted);
|
||||||
(
|
|
||||||
xferMoveTo<List<Face> >(dynFaces),
|
|
||||||
xferMoveTo<List<label> >(dynRegions),
|
|
||||||
sorted
|
|
||||||
);
|
|
||||||
|
|
||||||
// add patches, culling empty groups
|
// add patches, culling empty groups
|
||||||
this->addPatches(dynSizes, dynNames, true);
|
this->addPatches(dynSizes, dynNames, true);
|
||||||
|
|||||||
@ -143,11 +143,7 @@ bool Foam::fileFormats::OFFsurfaceFormat<Face>::read
|
|||||||
}
|
}
|
||||||
|
|
||||||
// transfer to normal lists
|
// transfer to normal lists
|
||||||
reset
|
reset(pointLst.xfer(), dynFaces.xfer());
|
||||||
(
|
|
||||||
xferMove(pointLst),
|
|
||||||
xferMoveTo<List<Face> >(dynFaces)
|
|
||||||
);
|
|
||||||
|
|
||||||
// no region information
|
// no region information
|
||||||
this->onePatch();
|
this->onePatch();
|
||||||
|
|||||||
@ -212,12 +212,7 @@ bool Foam::fileFormats::STARCDsurfaceFormat<Face>::read
|
|||||||
}
|
}
|
||||||
mapPointId.clear();
|
mapPointId.clear();
|
||||||
|
|
||||||
sortFacesAndStore
|
sortFacesAndStore(dynFaces.xfer(), dynRegions.xfer(), sorted);
|
||||||
(
|
|
||||||
xferMoveTo<List<Face> >(dynFaces),
|
|
||||||
xferMoveTo<List<label> >(dynRegions),
|
|
||||||
sorted
|
|
||||||
);
|
|
||||||
|
|
||||||
// add patches, culling empty groups
|
// add patches, culling empty groups
|
||||||
this->addPatches(dynSizes, dynNames, true);
|
this->addPatches(dynSizes, dynNames, true);
|
||||||
|
|||||||
@ -293,9 +293,9 @@ bool Foam::fileFormats::STLsurfaceFormat<Face>::read
|
|||||||
this->storedPoints().transfer(reader.points());
|
this->storedPoints().transfer(reader.points());
|
||||||
|
|
||||||
// retrieve the original region information
|
// retrieve the original region information
|
||||||
List<word> names(xferMove(reader.names()));
|
List<word> names(reader.names().xfer());
|
||||||
List<label> sizes(xferMove(reader.sizes()));
|
List<label> sizes(reader.sizes().xfer());
|
||||||
List<label> regions(xferMove(reader.regions()));
|
List<label> regions(reader.regions().xfer());
|
||||||
|
|
||||||
// generate the (sorted) faces
|
// generate the (sorted) faces
|
||||||
List<Face> faceLst(regions.size());
|
List<Face> faceLst(regions.size());
|
||||||
|
|||||||
@ -267,7 +267,7 @@ Foam::fileFormats::surfaceFormatsCore::checkSupport
|
|||||||
else if (verbose)
|
else if (verbose)
|
||||||
{
|
{
|
||||||
wordList toc = available.toc();
|
wordList toc = available.toc();
|
||||||
SortableList<word> known(xferMove(toc));
|
SortableList<word> known(toc.xfer());
|
||||||
|
|
||||||
Info<<"Unknown file extension for " << functionName
|
Info<<"Unknown file extension for " << functionName
|
||||||
<< " : " << ext << nl
|
<< " : " << ext << nl
|
||||||
|
|||||||
@ -88,8 +88,8 @@ bool Foam::fileFormats::TRIsurfaceFormat<Face>::read
|
|||||||
this->storedPoints().transfer(reader.points());
|
this->storedPoints().transfer(reader.points());
|
||||||
|
|
||||||
// retrieve the original region information
|
// retrieve the original region information
|
||||||
List<label> sizes(xferMove(reader.sizes()));
|
List<label> sizes(reader.sizes().xfer());
|
||||||
List<label> regions(xferMove(reader.regions()));
|
List<label> regions(reader.regions().xfer());
|
||||||
|
|
||||||
// generate the (sorted) faces
|
// generate the (sorted) faces
|
||||||
List<Face> faceLst(regions.size());
|
List<Face> faceLst(regions.size());
|
||||||
|
|||||||
@ -326,13 +326,10 @@ bool triSurface::readAC(const fileName& ACfileName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
points.shrink();
|
|
||||||
faces.shrink();
|
faces.shrink();
|
||||||
|
|
||||||
// Transfer DynamicLists to straight ones.
|
// Transfer DynamicLists to straight ones.
|
||||||
pointField allPoints;
|
pointField allPoints(points.xfer());
|
||||||
allPoints.transfer(points);
|
|
||||||
points.clear();
|
|
||||||
|
|
||||||
*this = triSurface(faces, patches, allPoints, true);
|
*this = triSurface(faces, patches, allPoints, true);
|
||||||
|
|
||||||
|
|||||||
@ -353,11 +353,8 @@ bool triSurface::readNAS(const fileName& fName)
|
|||||||
|
|
||||||
Info<< "patches:" << patches << endl;
|
Info<< "patches:" << patches << endl;
|
||||||
|
|
||||||
|
|
||||||
// Transfer DynamicLists to straight ones.
|
// Transfer DynamicLists to straight ones.
|
||||||
pointField allPoints;
|
pointField allPoints(points.xfer());
|
||||||
allPoints.transfer(points);
|
|
||||||
points.clear();
|
|
||||||
|
|
||||||
// Create triSurface
|
// Create triSurface
|
||||||
*this = triSurface(faces, patches, allPoints, true);
|
*this = triSurface(faces, patches, allPoints, true);
|
||||||
|
|||||||
@ -194,8 +194,7 @@ bool triSurface::readOBJ(const fileName& OBJfileName)
|
|||||||
|
|
||||||
|
|
||||||
// Transfer DynamicLists to straight ones.
|
// Transfer DynamicLists to straight ones.
|
||||||
pointField allPoints;
|
pointField allPoints(points.xfer());
|
||||||
allPoints.transfer(points);
|
|
||||||
|
|
||||||
// Create triSurface
|
// Create triSurface
|
||||||
*this = triSurface(faces, patches, allPoints, true);
|
*this = triSurface(faces, patches, allPoints, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user