Commit c826865f authored by Mark Olesen's avatar Mark Olesen
Browse files

using .xfer() method instead of xferMoveTo<...> in a few places

parent 95dcb6de
......@@ -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
(
......
......@@ -55,7 +55,7 @@ class IOobject;
class polyTopoChange;
/*---------------------------------------------------------------------------*\
Class polyMeshAdder Declaration
Class polyMeshAdder Declaration
\*---------------------------------------------------------------------------*/
class polyMeshAdder
......
......@@ -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();
......
......@@ -110,7 +110,7 @@ bool Foam::surfaceIntersection::excludeEdgeHit
// << " e0Vec:" << e0Vec << " n:" << n
// << " normalComponent:" << (n & surf.faceNormals()[faceI])
// << " tol:" << tol << endl;
//
//
// return true;
// }
// else
......@@ -399,7 +399,7 @@ void Foam::surfaceIntersection::classifyHit
{
// 4. Edge hits edge.
// Cut edge with new point (creates duplicates when
// Cut edge with new point (creates duplicates when
// doing the surf2 with surf1 intersection but these
// are merged later on)
......@@ -509,7 +509,7 @@ void Foam::surfaceIntersection::classifyHit
<< " coords:" << surf1.localPoints()[e.start()]
<< surf1.localPoints()[e.end()] << endl;
}
// Reclassify as normal edge-face pierce (see below)
allCutPoints.append(hitPt);
......@@ -533,7 +533,7 @@ void Foam::surfaceIntersection::classifyHit
<< " since edge " << e << " on inside of surf2."
<< " surf2 normal:" << surf2.faceNormals()[surf2FaceI]
<< endl;
}
}
}
}
else
......@@ -636,7 +636,7 @@ void Foam::surfaceIntersection::doCutEdges
// Label of face on surface2 edgeI intersected
label hitFaceI = pHit.index();
if
if
(
!excludeEdgeHit
(
......@@ -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,10 +1040,10 @@ 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.
// Shortcut.
if (cutPoints_.empty() && cutEdges_.empty())
{
if (debug)
......@@ -1071,7 +1071,7 @@ Foam::surfaceIntersection::surfaceIntersection
// Merge points
labelList pointMap;
pointField newPoints;
bool hasMerged = mergePoints
(
cutPoints_,
......
......@@ -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);
}
// 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());
dstLst.setSize(srcLst.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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment