Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102606339
periodic_node_synchronizer_tmpl.hh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Feb 22, 11:13
Size
2 KB
Mime Type
text/x-c++
Expires
Mon, Feb 24, 11:13 (2 d)
Engine
blob
Format
Raw Data
Handle
24370342
Attached To
rAKA akantu
periodic_node_synchronizer_tmpl.hh
View Options
/**
* Copyright (©) 2016-2023 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* This file is part of Akantu
*
* Akantu is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* Akantu is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Akantu. If not, see <http://www.gnu.org/licenses/>.
*/
/* -------------------------------------------------------------------------- */
#include "aka_common.hh"
#include "periodic_node_synchronizer.hh"
/* -------------------------------------------------------------------------- */
#ifndef AKANTU_PERIODIC_NODE_SYNCHRONIZER_TMPL_HH
#define AKANTU_PERIODIC_NODE_SYNCHRONIZER_TMPL_HH
namespace
akantu
{
/* -------------------------------------------------------------------------- */
template
<
typename
T
>
void
PeriodicNodeSynchronizer
::
synchronizeArrayLocal
(
Array
<
T
>
&
array
)
const
{
auto
tag
=
SynchronizationTag
::
_whatever
;
SimpleIdxDataAccessor
<
T
>
data_accessor
(
array
,
SynchronizationTag
::
_whatever
);
auto
size
=
data_accessor
.
getNbData
(
masters_list
,
tag
);
CommunicationBuffer
buffer
(
size
);
data_accessor
.
packData
(
buffer
,
masters_list
,
SynchronizationTag
::
_whatever
);
data_accessor
.
unpackData
(
buffer
,
slaves_list
,
SynchronizationTag
::
_whatever
);
}
/* -------------------------------------------------------------------------- */
template
<
typename
T
>
void
PeriodicNodeSynchronizer
::
synchronizeArrayPBC
(
Array
<
T
>
&
array
)
const
{
this
->
synchronizeArray
(
array
);
this
->
synchronizeArrayLocal
(
array
);
}
/* -------------------------------------------------------------------------- */
template
<
template
<
class
>
class
Op
,
typename
T
>
void
PeriodicNodeSynchronizer
::
reduceSynchronizeArrayLocal
(
Array
<
T
>
&
array
)
const
{
auto
tag
=
SynchronizationTag
::
_whatever
;
ReduceDataAccessor
<
Idx
,
Op
,
T
>
data_accessor
(
array
,
tag
);
auto
size
=
data_accessor
.
getNbData
(
slaves_list
,
tag
);
CommunicationBuffer
buffer
(
size
);
data_accessor
.
packData
(
buffer
,
slaves_list
,
tag
);
data_accessor
.
unpackData
(
buffer
,
masters_list
,
tag
);
}
/* -------------------------------------------------------------------------- */
template
<
template
<
class
>
class
Op
,
typename
T
>
void
PeriodicNodeSynchronizer
::
reduceSynchronizeArrayPBC
(
Array
<
T
>
&
array
)
const
{
this
->
reduceSynchronizeArrayLocal
<
Op
>
(
array
);
this
->
reduceSynchronizeArray
<
Op
>
(
array
);
this
->
synchronizeArrayLocal
(
array
);
}
}
// namespace akantu
#endif
/* AKANTU_PERIODIC_NODE_SYNCHRONIZER_TMPL_HH */
Event Timeline
Log In to Comment