From 00bf7f4d4255220eec3b197c05d61aea37bdcac1 Mon Sep 17 00:00:00 2001 From: Azusa Yamaguchi Date: Mon, 1 Jun 2015 12:25:59 +0100 Subject: [PATCH] Const safety --- lib/cshift/Grid_cshift_common.h | 8 ++++---- lib/cshift/Grid_cshift_mpi.h | 10 +++++----- lib/cshift/Grid_cshift_none.h | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/cshift/Grid_cshift_common.h b/lib/cshift/Grid_cshift_common.h index 06e812d9..ffa3f771 100644 --- a/lib/cshift/Grid_cshift_common.h +++ b/lib/cshift/Grid_cshift_common.h @@ -153,7 +153,7 @@ PARALLEL_NESTED_LOOP2 ////////////////////////////////////////////////////// // local to node block strided copies ////////////////////////////////////////////////////// -template void Copy_plane(Lattice& lhs,Lattice &rhs, int dimension,int lplane,int rplane,int cbmask) +template void Copy_plane(Lattice& lhs,const Lattice &rhs, int dimension,int lplane,int rplane,int cbmask) { int rd = rhs._grid->_rdimensions[dimension]; @@ -182,7 +182,7 @@ PARALLEL_NESTED_LOOP2 } -template void Copy_plane_permute(Lattice& lhs,Lattice &rhs, int dimension,int lplane,int rplane,int cbmask,int permute_type) +template void Copy_plane_permute(Lattice& lhs,const Lattice &rhs, int dimension,int lplane,int rplane,int cbmask,int permute_type) { int rd = rhs._grid->_rdimensions[dimension]; @@ -212,7 +212,7 @@ PARALLEL_NESTED_LOOP2 ////////////////////////////////////////////////////// // Local to node Cshift ////////////////////////////////////////////////////// -template void Cshift_local(Lattice& ret,Lattice &rhs,int dimension,int shift) +template void Cshift_local(Lattice& ret,const Lattice &rhs,int dimension,int shift) { int sshift[2]; @@ -227,7 +227,7 @@ template void Cshift_local(Lattice& ret,Lattice &rhs,int } } -template Lattice Cshift_local(Lattice &ret,Lattice &rhs,int dimension,int shift,int cbmask) +template Lattice Cshift_local(Lattice &ret,const Lattice &rhs,int dimension,int shift,int cbmask) { GridBase *grid = rhs._grid; int fd = grid->_fdimensions[dimension]; diff --git a/lib/cshift/Grid_cshift_mpi.h b/lib/cshift/Grid_cshift_mpi.h index 3b3fad29..9cdfd316 100644 --- a/lib/cshift/Grid_cshift_mpi.h +++ b/lib/cshift/Grid_cshift_mpi.h @@ -4,7 +4,7 @@ namespace Grid { -template Lattice Cshift(Lattice &rhs,int dimension,int shift) +template Lattice Cshift(const Lattice &rhs,int dimension,int shift) { typedef typename vobj::vector_type vector_type; typedef typename vobj::scalar_type scalar_type; @@ -35,7 +35,7 @@ template Lattice Cshift(Lattice &rhs,int dimension,int s return ret; } -template void Cshift_comms(Lattice& ret,Lattice &rhs,int dimension,int shift) +template void Cshift_comms(Lattice& ret,const Lattice &rhs,int dimension,int shift) { int sshift[2]; @@ -50,7 +50,7 @@ template void Cshift_comms(Lattice& ret,Lattice &rhs,int } } -template void Cshift_comms_simd(Lattice& ret,Lattice &rhs,int dimension,int shift) +template void Cshift_comms_simd(Lattice& ret,const Lattice &rhs,int dimension,int shift) { int sshift[2]; @@ -65,7 +65,7 @@ template void Cshift_comms_simd(Lattice& ret,Lattice &rh } } -template void Cshift_comms(Lattice &ret,Lattice &rhs,int dimension,int shift,int cbmask) +template void Cshift_comms(Lattice &ret,const Lattice &rhs,int dimension,int shift,int cbmask) { typedef typename vobj::vector_type vector_type; typedef typename vobj::scalar_type scalar_type; @@ -124,7 +124,7 @@ template void Cshift_comms(Lattice &ret,Lattice &rhs,int } } -template void Cshift_comms_simd(Lattice &ret,Lattice &rhs,int dimension,int shift,int cbmask) +template void Cshift_comms_simd(Lattice &ret,const Lattice &rhs,int dimension,int shift,int cbmask) { GridBase *grid=rhs._grid; const int Nsimd = grid->Nsimd(); diff --git a/lib/cshift/Grid_cshift_none.h b/lib/cshift/Grid_cshift_none.h index be9467b1..a8c6f6c0 100644 --- a/lib/cshift/Grid_cshift_none.h +++ b/lib/cshift/Grid_cshift_none.h @@ -1,7 +1,7 @@ #ifndef _GRID_CSHIFT_NONE_H_ #define _GRID_CSHIFT_NONE_H_ namespace Grid { -template Lattice Cshift(Lattice &rhs,int dimension,int shift) +template Lattice Cshift(const Lattice &rhs,int dimension,int shift) { Lattice ret(rhs._grid); ret.checkerboard = rhs._grid->CheckerBoardDestination(rhs.checkerboard,shift,dimension);