Skip to content
Snippets Groups Projects
Commit b76f2421 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

STYLE: default construct/assignment for mergedSurf

COMP: fix incorrect reference in meshedSurfRef
parent 07dafe7b
Branches
Tags
No related merge requests found
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -29,24 +29,42 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::mergedSurf::mergedSurf()
Foam::mergedSurf::mergedSurf
(
const meshedSurf& unmergedSurface,
const scalar mergeDim
)
:
points_(),
faces_(),
zones_(),
pointsMap_()
{}
mergedSurf()
{
merge(unmergedSurface, mergeDim);
}
Foam::mergedSurf::mergedSurf
(
const pointField& unmergedPoints,
const faceList& unmergedFaces,
const scalar mergeDim
)
:
mergedSurf()
{
merge(unmergedPoints, unmergedFaces, mergeDim);
}
Foam::mergedSurf::mergedSurf
(
const meshedSurf& surf,
const pointField& unmergedPoints,
const faceList& unmergedFaces,
const labelList& originalIds,
const scalar mergeDim
)
:
mergedSurf()
{
merge(surf, mergeDim);
merge(unmergedPoints, unmergedFaces, originalIds, mergeDim);
}
......@@ -69,15 +87,43 @@ void Foam::mergedSurf::clear()
bool Foam::mergedSurf::merge
(
const meshedSurf& surf,
const meshedSurf& unmergedSurface,
const scalar mergeDim
)
{
// needed for extra safety?
// clear();
return
merge
(
unmergedSurface.points(),
unmergedSurface.faces(),
unmergedSurface.zoneIds(),
mergeDim
);
}
bool Foam::mergedSurf::merge
(
const pointField& unmergedPoints,
const faceList& unmergedFaces,
const scalar mergeDim
)
{
return merge(unmergedPoints, unmergedFaces, labelList(), mergeDim);
}
bool Foam::mergedSurf::merge
(
const pointField& unmergedPoints,
const faceList& unmergedFaces,
const labelList& originalIds,
const scalar mergeDim
)
{
if (!use())
{
clear(); // Extra safety?
return false;
}
......@@ -86,8 +132,8 @@ bool Foam::mergedSurf::merge
mergeDim,
primitivePatch
(
SubList<face>(surf.faces(), surf.faces().size()),
surf.points()
SubList<face>(unmergedFaces, unmergedFaces.size()),
unmergedPoints
),
points_,
faces_,
......@@ -96,7 +142,7 @@ bool Foam::mergedSurf::merge
// Now handle zone/region information
List<labelList> allZones(Pstream::nProcs());
allZones[Pstream::myProcNo()] = surf.zoneIds();
allZones[Pstream::myProcNo()] = originalIds;
Pstream::gatherList(allZones);
if (Pstream::master())
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -25,7 +25,9 @@ Class
Foam::mergedSurf
Description
Simple class to manage surface merging information
Simple class to manage surface merging information.
Merging is done with PatchTools::gatherAndMerge()
SourceFiles
mergedSurf.C
......@@ -55,20 +57,43 @@ class mergedSurf
labelList zones_;
labelList pointsMap_;
//- No copy construct
mergedSurf(const mergedSurf&) = delete;
// Assignment is needed for lists
public:
// Constructors
//- Construct null
mergedSurf();
//- Construct and merge meshed surfaces immediately (in parallel only).
mergedSurf(const meshedSurf&, const scalar mergeDim);
mergedSurf() = default;
//- Copy construct null
mergedSurf(const mergedSurf&) = default;
//- Move construct
mergedSurf(mergedSurf&&) = default;
//- Construct and merge.
mergedSurf
(
const meshedSurf& unmergedSurface,
const scalar mergeDim
);
//- Construct and merge.
mergedSurf
(
const pointField& unmergedPoints,
const faceList& unmergedFaces,
const scalar mergeDim
);
//- Construct and merge
mergedSurf
(
const pointField& unmergedPoints,
const faceList& unmergedFaces,
const labelList& originalIds,
const scalar mergeDim
);
//- Destructor
......@@ -117,7 +142,37 @@ public:
void clear();
//- Merge meshed surfaces (in parallel only).
bool merge(const meshedSurf&, const scalar mergeDim);
bool merge
(
const meshedSurf& unmergedSurface,
const scalar mergeDim
);
//- Merge meshed surfaces (in parallel only).
bool merge
(
const pointField& unmergedPoints,
const faceList& unmergedFaces,
const scalar mergeDim
);
//- Merge meshed surfaces (in parallel only).
bool merge
(
const pointField& unmergedPoints,
const faceList& unmergedFaces,
const labelList& originalIds,
const scalar mergeDim
);
// Member Operators
//- Copy assignment
mergedSurf& operator=(const mergedSurf&) = default;
//- Move assignment
mergedSurf& operator=(mergedSurf&&) = default;
};
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -69,7 +69,7 @@ public:
(
const pointField& pts,
const faceList& faces,
const labelUList& ids = Foam::emptyLabelList
const labelList& ids = labelList()
)
:
points_(pts),
......
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