A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
[sonar] Initialize data members with class initializers, or initialization lists.
[simgrid.git]
/
src
/
smpi
/
mpi
/
smpi_datatype.cpp
diff --git
a/src/smpi/mpi/smpi_datatype.cpp
b/src/smpi/mpi/smpi_datatype.cpp
index
b82b801
..
8a7773c
100644
(file)
--- a/
src/smpi/mpi/smpi_datatype.cpp
+++ b/
src/smpi/mpi/smpi_datatype.cpp
@@
-107,14
+107,16
@@
Datatype::Datatype(int ident, int size, MPI_Aint lb, MPI_Aint ub, int flags) : D
{
id = std::to_string(ident);
}
-Datatype::Datatype(int size,MPI_Aint lb, MPI_Aint ub, int flags) : name_(nullptr), size_(size), lb_(lb), ub_(ub), flags_(flags), refcount_(1){
+
+Datatype::Datatype(int size, MPI_Aint lb, MPI_Aint ub, int flags) : size_(size), lb_(lb), ub_(ub), flags_(flags)
+{
#if SIMGRID_HAVE_MC
if(MC_is_active())
MC_ignore(&(refcount_), sizeof(refcount_));
#endif
}
-//
for predefined types, so in_use
= 0.
+//
for predefined types, so refcount_
= 0.
Datatype::Datatype(char* name, int ident, int size, MPI_Aint lb, MPI_Aint ub, int flags)
: name_(name), id(std::to_string(ident)), size_(size), lb_(lb), ub_(ub), flags_(flags), refcount_(0)
{
@@
-125,7
+127,8
@@
Datatype::Datatype(char* name, int ident, int size, MPI_Aint lb, MPI_Aint ub, in
#endif
}
-Datatype::Datatype(Datatype *datatype, int* ret) : name_(nullptr), size_(datatype->size_), lb_(datatype->lb_), ub_(datatype->ub_), flags_(datatype->flags_), refcount_(1)
+Datatype::Datatype(Datatype* datatype, int* ret)
+ : size_(datatype->size_), lb_(datatype->lb_), ub_(datatype->ub_), flags_(datatype->flags_)
{
flags_ &= ~DT_FLAG_PREDEFINED;
*ret = MPI_SUCCESS;
@@
-160,7
+163,8
@@
Datatype::Datatype(Datatype *datatype, int* ret) : name_(nullptr), size_(datatyp
}
}
-Datatype::~Datatype(){
+Datatype::~Datatype()
+{
xbt_assert(refcount_ >= 0);
if(flags_ & DT_FLAG_PREDEFINED)
@@
-177,8
+181,8
@@
Datatype::~Datatype(){
xbt_free(name_);
}
-void Datatype::ref()
{
-
+void Datatype::ref()
+{
refcount_++;
#if SIMGRID_HAVE_MC
@@
-270,12
+274,12
@@
int Datatype::unpack(const void* inbuf, int insize, int* position, void* outbuf,
return MPI_SUCCESS;
}
-int Datatype::copy(const void
*sendbuf, int sendcount, MPI_Datatype sendtype
,
- void *recvbuf, int recvcount, MPI_Datatype recvtype){
-
-// FIXME Handle the case of a partial shared malloc.
+int Datatype::copy(const void
* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount
,
+ MPI_Datatype recvtype)
+{
+
// FIXME Handle the case of a partial shared malloc.
- if (smpi_
privatize_global_variables
== SmpiPrivStrategies::MMAP) {
+ if (smpi_
cfg_privatization()
== SmpiPrivStrategies::MMAP) {
smpi_switch_data_segment(simgrid::s4u::Actor::self());
}
/* First check if we really have something to do */
@@
-306,8
+310,7
@@
int Datatype::copy(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
recvtype->unserialize(sendbuf, recvbuf, count / recvtype->size(), MPI_REPLACE);
} else if (not(recvtype->flags() & DT_FLAG_DERIVED)) {
sendtype->serialize(sendbuf, recvbuf, count / sendtype->size());
- }else{
-
+ } else {
void * buf_tmp = xbt_malloc(count);
sendtype->serialize( sendbuf, buf_tmp,count/sendtype->size());
@@
-583,11
+586,9
@@
int Datatype::create_resized(MPI_Datatype oldtype,MPI_Aint lb, MPI_Aint extent,
return MPI_SUCCESS;
}
-Datatype* Datatype::f2c(int id){
+Datatype* Datatype::f2c(int id)
+{
return static_cast<Datatype*>(F2C::f2c(id));
}
-
-
-}
-}
-
+} // namespace smpi
+} // namespace simgrid