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
|
||||
|
||||
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>
|
||||
Field<Type>::Field(const Xfer<Field<Type> >& f)
|
||||
:
|
||||
|
||||
@ -114,6 +114,9 @@ public:
|
||||
//- Construct as copy of a 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
|
||||
Field
|
||||
(
|
||||
|
||||
@ -2952,9 +2952,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChange::changeMesh
|
||||
mesh.resetPrimitives
|
||||
(
|
||||
xferMove(renumberedMeshPoints),
|
||||
xferMoveTo<faceList>(faces_),
|
||||
xferMoveTo<labelList>(faceOwner_),
|
||||
xferMoveTo<labelList>(faceNeighbour_),
|
||||
faces_.xfer(),
|
||||
faceOwner_.xfer(),
|
||||
faceNeighbour_.xfer(),
|
||||
patchSizes,
|
||||
patchStarts,
|
||||
syncParallel
|
||||
@ -2968,9 +2968,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChange::changeMesh
|
||||
mesh.resetPrimitives
|
||||
(
|
||||
xferMove(newPoints),
|
||||
xferMoveTo<faceList>(faces_),
|
||||
xferMoveTo<labelList>(faceOwner_),
|
||||
xferMoveTo<labelList>(faceNeighbour_),
|
||||
faces_.xfer(),
|
||||
faceOwner_.xfer(),
|
||||
faceNeighbour_.xfer(),
|
||||
patchSizes,
|
||||
patchStarts,
|
||||
syncParallel
|
||||
@ -3195,9 +3195,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChange::makeMesh
|
||||
(
|
||||
io,
|
||||
xferMove(newPoints),
|
||||
xferMoveTo<faceList>(faces_),
|
||||
xferMoveTo<labelList>(faceOwner_),
|
||||
xferMoveTo<labelList>(faceNeighbour_)
|
||||
faces_.xfer(),
|
||||
faceOwner_.xfer(),
|
||||
faceNeighbour_.xfer()
|
||||
)
|
||||
);
|
||||
fvMesh& newMesh = newMeshPtr();
|
||||
|
||||
@ -803,8 +803,8 @@ Foam::surfaceIntersection::surfaceIntersection
|
||||
|
||||
// Transfer to straight label(List)List
|
||||
transfer(edgeCuts2, surf2EdgeCuts_);
|
||||
transfer(allCutEdges, cutEdges_);
|
||||
transfer(allCutPoints, cutPoints_);
|
||||
cutEdges_.transfer(allCutEdges);
|
||||
cutPoints_.transfer(allCutPoints);
|
||||
|
||||
|
||||
if (debug)
|
||||
@ -936,8 +936,8 @@ Foam::surfaceIntersection::surfaceIntersection
|
||||
|
||||
|
||||
// Transfer to straight label(List)List
|
||||
transfer(allCutEdges, cutEdges_);
|
||||
transfer(allCutPoints, cutPoints_);
|
||||
cutEdges_.transfer(allCutEdges);
|
||||
cutPoints_.transfer(allCutPoints);
|
||||
|
||||
|
||||
if (debug)
|
||||
@ -1040,8 +1040,8 @@ Foam::surfaceIntersection::surfaceIntersection
|
||||
|
||||
// Transfer to straight label(List)List
|
||||
transfer(edgeCuts1, surf1EdgeCuts_);
|
||||
transfer(allCutEdges, cutEdges_);
|
||||
transfer(allCutPoints, cutPoints_);
|
||||
cutEdges_.transfer(allCutEdges);
|
||||
cutPoints_.transfer(allCutPoints);
|
||||
|
||||
// Shortcut.
|
||||
if (cutPoints_.empty() && cutEdges_.empty())
|
||||
|
||||
@ -120,10 +120,6 @@ class surfaceIntersection
|
||||
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<..>>
|
||||
template<class T>
|
||||
static void transfer(List<DynamicList<T> >&, List<List<T> >&);
|
||||
|
||||
@ -34,27 +34,15 @@ Description
|
||||
template<class T>
|
||||
void Foam::surfaceIntersection::transfer
|
||||
(
|
||||
DynamicList<T>& dList,
|
||||
List<T>& lList
|
||||
List<DynamicList<T> >& srcLst,
|
||||
List<List<T> >& dstLst
|
||||
)
|
||||
{
|
||||
lList.transfer(dList);
|
||||
}
|
||||
dstLst.setSize(srcLst.size());
|
||||
|
||||
|
||||
// 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)
|
||||
forAll(srcLst, 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.
|
||||
template<class Face>
|
||||
void Foam::BasicMeshedSurface<Face>::cleanup(const bool verbose)
|
||||
|
||||
@ -138,6 +138,13 @@ public:
|
||||
const Xfer<List<Face> >&
|
||||
);
|
||||
|
||||
//- Transfer components (points, faces).
|
||||
virtual void reset
|
||||
(
|
||||
const Xfer<List<point> >&,
|
||||
const Xfer<List<Face> >&
|
||||
);
|
||||
|
||||
//- Remove invalid faces
|
||||
virtual void cleanup(const bool verbose);
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ bool Foam::MeshedSurface<Face>::read(Istream& is)
|
||||
surf.reset
|
||||
(
|
||||
Xfer<pointField>::null(),
|
||||
xferMove(faceLst)
|
||||
faceLst.xfer()
|
||||
);
|
||||
surf.addPatches(patches_);
|
||||
|
||||
|
||||
@ -389,12 +389,7 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
|
||||
}
|
||||
|
||||
|
||||
sortFacesAndStore
|
||||
(
|
||||
xferMoveTo<List<Face> >(dynFaces),
|
||||
xferMoveTo<List<label> >(dynRegions),
|
||||
sorted
|
||||
);
|
||||
sortFacesAndStore(dynFaces.xfer(), dynRegions.xfer(), sorted);
|
||||
|
||||
// add patches, culling empty groups
|
||||
this->addPatches(dynSizes, names, true);
|
||||
|
||||
@ -202,12 +202,7 @@ bool Foam::fileFormats::OBJsurfaceFormat<Face>::read
|
||||
// transfer to normal lists
|
||||
this->storedPoints().transfer(dynPoints);
|
||||
|
||||
sortFacesAndStore
|
||||
(
|
||||
xferMoveTo<List<Face> >(dynFaces),
|
||||
xferMoveTo<List<label> >(dynRegions),
|
||||
sorted
|
||||
);
|
||||
sortFacesAndStore(dynFaces.xfer(), dynRegions.xfer(), sorted);
|
||||
|
||||
// add patches, culling empty groups
|
||||
this->addPatches(dynSizes, dynNames, true);
|
||||
|
||||
@ -143,11 +143,7 @@ bool Foam::fileFormats::OFFsurfaceFormat<Face>::read
|
||||
}
|
||||
|
||||
// transfer to normal lists
|
||||
reset
|
||||
(
|
||||
xferMove(pointLst),
|
||||
xferMoveTo<List<Face> >(dynFaces)
|
||||
);
|
||||
reset(pointLst.xfer(), dynFaces.xfer());
|
||||
|
||||
// no region information
|
||||
this->onePatch();
|
||||
|
||||
@ -212,12 +212,7 @@ bool Foam::fileFormats::STARCDsurfaceFormat<Face>::read
|
||||
}
|
||||
mapPointId.clear();
|
||||
|
||||
sortFacesAndStore
|
||||
(
|
||||
xferMoveTo<List<Face> >(dynFaces),
|
||||
xferMoveTo<List<label> >(dynRegions),
|
||||
sorted
|
||||
);
|
||||
sortFacesAndStore(dynFaces.xfer(), dynRegions.xfer(), sorted);
|
||||
|
||||
// add patches, culling empty groups
|
||||
this->addPatches(dynSizes, dynNames, true);
|
||||
|
||||
@ -293,9 +293,9 @@ bool Foam::fileFormats::STLsurfaceFormat<Face>::read
|
||||
this->storedPoints().transfer(reader.points());
|
||||
|
||||
// retrieve the original region information
|
||||
List<word> names(xferMove(reader.names()));
|
||||
List<label> sizes(xferMove(reader.sizes()));
|
||||
List<label> regions(xferMove(reader.regions()));
|
||||
List<word> names(reader.names().xfer());
|
||||
List<label> sizes(reader.sizes().xfer());
|
||||
List<label> regions(reader.regions().xfer());
|
||||
|
||||
// generate the (sorted) faces
|
||||
List<Face> faceLst(regions.size());
|
||||
|
||||
@ -267,7 +267,7 @@ Foam::fileFormats::surfaceFormatsCore::checkSupport
|
||||
else if (verbose)
|
||||
{
|
||||
wordList toc = available.toc();
|
||||
SortableList<word> known(xferMove(toc));
|
||||
SortableList<word> known(toc.xfer());
|
||||
|
||||
Info<<"Unknown file extension for " << functionName
|
||||
<< " : " << ext << nl
|
||||
|
||||
@ -88,8 +88,8 @@ bool Foam::fileFormats::TRIsurfaceFormat<Face>::read
|
||||
this->storedPoints().transfer(reader.points());
|
||||
|
||||
// retrieve the original region information
|
||||
List<label> sizes(xferMove(reader.sizes()));
|
||||
List<label> regions(xferMove(reader.regions()));
|
||||
List<label> sizes(reader.sizes().xfer());
|
||||
List<label> regions(reader.regions().xfer());
|
||||
|
||||
// generate the (sorted) faces
|
||||
List<Face> faceLst(regions.size());
|
||||
|
||||
@ -326,13 +326,10 @@ bool triSurface::readAC(const fileName& ACfileName)
|
||||
}
|
||||
}
|
||||
|
||||
points.shrink();
|
||||
faces.shrink();
|
||||
|
||||
// Transfer DynamicLists to straight ones.
|
||||
pointField allPoints;
|
||||
allPoints.transfer(points);
|
||||
points.clear();
|
||||
pointField allPoints(points.xfer());
|
||||
|
||||
*this = triSurface(faces, patches, allPoints, true);
|
||||
|
||||
|
||||
@ -353,11 +353,8 @@ bool triSurface::readNAS(const fileName& fName)
|
||||
|
||||
Info<< "patches:" << patches << endl;
|
||||
|
||||
|
||||
// Transfer DynamicLists to straight ones.
|
||||
pointField allPoints;
|
||||
allPoints.transfer(points);
|
||||
points.clear();
|
||||
pointField allPoints(points.xfer());
|
||||
|
||||
// Create triSurface
|
||||
*this = triSurface(faces, patches, allPoints, true);
|
||||
|
||||
@ -194,8 +194,7 @@ bool triSurface::readOBJ(const fileName& OBJfileName)
|
||||
|
||||
|
||||
// Transfer DynamicLists to straight ones.
|
||||
pointField allPoints;
|
||||
allPoints.transfer(points);
|
||||
pointField allPoints(points.xfer());
|
||||
|
||||
// Create triSurface
|
||||
*this = triSurface(faces, patches, allPoints, true);
|
||||
|
||||
Reference in New Issue
Block a user