Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
0c0bc572
Commit
0c0bc572
authored
Sep 19, 2018
by
mattijs
Browse files
ENH: mapDistribute: extra constructor. Used in
#284
.
parent
5cd75ac7
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C
View file @
0c0bc572
...
...
@@ -480,6 +480,17 @@ Foam::mapDistribute::mapDistribute
}
Foam
::
mapDistribute
::
mapDistribute
(
labelListList
&&
subMap
,
const
bool
subHasFlip
,
const
bool
constructHasFlip
)
:
mapDistributeBase
(
std
::
move
(
subMap
),
subHasFlip
,
constructHasFlip
)
{}
Foam
::
mapDistribute
::
mapDistribute
(
Istream
&
is
)
{
is
>>
*
this
;
...
...
src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H
View file @
0c0bc572
...
...
@@ -325,10 +325,10 @@ public:
mapDistribute
();
//- Copy construct
mapDistribute
(
const
mapDistribute
&
map
);
explicit
mapDistribute
(
const
mapDistribute
&
map
);
//- Move construct
mapDistribute
(
mapDistribute
&&
map
);
explicit
mapDistribute
(
mapDistribute
&&
map
);
//- Move construct from components
mapDistribute
...
...
@@ -416,8 +416,18 @@ public:
const
int
tag
=
Pstream
::
msgType
()
);
//- Construct from my elements to send. Assumes layout is my elements
// first followed by elements from all other processors in consecutive
// order
mapDistribute
(
labelListList
&&
subMap
,
const
bool
subHasFlip
=
false
,
const
bool
constructHasFlip
=
false
);
//- Construct from Istream
mapDistribute
(
Istream
&
is
);
explicit
mapDistribute
(
Istream
&
is
);
//- Clone
autoPtr
<
mapDistribute
>
clone
()
const
;
...
...
src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBase.C
View file @
0c0bc572
...
...
@@ -790,6 +790,58 @@ Foam::mapDistributeBase::mapDistributeBase
}
Foam
::
mapDistributeBase
::
mapDistributeBase
(
labelListList
&&
subMap
,
const
bool
subHasFlip
,
const
bool
constructHasFlip
)
:
constructSize_
(
0
),
subMap_
(
std
::
move
(
subMap
)),
subHasFlip_
(
subHasFlip
),
constructHasFlip_
(
constructHasFlip
),
schedulePtr_
()
{
// Send over how many i need to receive.
labelList
recvSizes
;
Pstream
::
exchangeSizes
(
subMap_
,
recvSizes
);
// Determine order of receiving
labelListList
constructMap
(
Pstream
::
nProcs
());
// My local segments first
label
nLocal
=
recvSizes
[
Pstream
::
myProcNo
()];
{
labelList
&
myMap
=
constructMap
[
Pstream
::
myProcNo
()];
myMap
.
setSize
(
nLocal
);
forAll
(
myMap
,
i
)
{
myMap
[
i
]
=
i
;
}
}
label
segmenti
=
nLocal
;
forAll
(
constructMap
,
proci
)
{
if
(
proci
!=
Pstream
::
myProcNo
())
{
// What i need to receive is what other processor is sending to me.
label
nRecv
=
recvSizes
[
proci
];
constructMap
[
proci
].
setSize
(
nRecv
);
for
(
label
i
=
0
;
i
<
nRecv
;
i
++
)
{
constructMap
[
proci
][
i
]
=
segmenti
++
;
}
}
}
constructSize_
=
segmenti
;
constructMap_
.
transfer
(
constructMap
);
}
Foam
::
mapDistributeBase
::
mapDistributeBase
(
Istream
&
is
)
{
is
>>
*
this
;
...
...
src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBase.H
View file @
0c0bc572
...
...
@@ -199,10 +199,10 @@ public:
mapDistributeBase
();
//- Copy construct
mapDistributeBase
(
const
mapDistributeBase
&
map
);
explicit
mapDistributeBase
(
const
mapDistributeBase
&
map
);
//- Move construct
mapDistributeBase
(
mapDistributeBase
&&
map
);
explicit
mapDistributeBase
(
mapDistributeBase
&&
map
);
//- Construct from components
mapDistributeBase
...
...
@@ -246,6 +246,16 @@ public:
const
int
tag
=
Pstream
::
msgType
()
);
//- Construct from my elements to send. Assumes layout is my elements
// first followed by elements from all other processors in consecutive
// order
mapDistributeBase
(
labelListList
&&
subMap
,
const
bool
subHasFlip
=
false
,
const
bool
constructHasFlip
=
false
);
//- Construct from Istream
mapDistributeBase
(
Istream
&
is
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment