Grid
0.7.0
Lattice_coordinate.h
Go to the documentation of this file.
1
/*************************************************************************************
2
3
Grid physics library, www.github.com/paboyle/Grid
4
5
Source file: ./lib/lattice/Lattice_coordinate.h
6
7
Copyright (C) 2015
8
9
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
10
11
This program is free software; you can redistribute it and/or modify
12
it under the terms of the GNU General Public License as published by
13
the Free Software Foundation; either version 2 of the License, or
14
(at your option) any later version.
15
16
This program is distributed in the hope that it will be useful,
17
but WITHOUT ANY WARRANTY; without even the implied warranty of
18
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
GNU General Public License for more details.
20
21
You should have received a copy of the GNU General Public License along
22
with this program; if not, write to the Free Software Foundation, Inc.,
23
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24
25
See the full license in the file "LICENSE" in the top level distribution directory
26
*************************************************************************************/
27
/* END LEGAL */
28
#pragma once
29
30
NAMESPACE_BEGIN
(
Grid
);
31
32
template
<
class
iobj>
inline
void
LatticeCoordinate
(
Lattice<iobj>
&l,
int
mu)
33
{
34
typedef
typename
iobj::scalar_type
scalar_type
;
35
typedef
typename
iobj::vector_type vector_type;
36
37
GridBase
*grid = l.
Grid
();
38
int
Nsimd = grid->
iSites
();
39
40
autoView
(l_v, l,
CpuWrite
);
41
thread_for
( o, grid->
oSites
(), {
42
vector_type vI;
43
Coordinate gcoor;
44
ExtractBuffer<scalar_type> mergebuf(Nsimd);
45
for(int i=0;i<grid->iSites();i++){
46
grid->RankIndexToGlobalCoor(grid->ThisRank(),o,i,gcoor);
47
mergebuf[i]=(Integer)gcoor[mu];
48
}
49
merge<vector_type,scalar_type>
(vI,mergebuf);
50
l_v[o]=vI;
51
});
52
};
53
54
NAMESPACE_END
(
Grid
);
55
LatticeCoordinate
void LatticeCoordinate(Lattice< iobj > &l, int mu)
Definition
Lattice_coordinate.h:32
autoView
#define autoView(l_v, l, mode)
Definition
Lattice_view.h:119
CpuWrite
@ CpuWrite
Definition
MemoryManager.h:70
NAMESPACE_BEGIN
#define NAMESPACE_BEGIN(A)
Definition
Namespace.h:35
NAMESPACE_END
#define NAMESPACE_END(A)
Definition
Namespace.h:36
merge
accelerator void merge(vobj &vec, ExtractBuffer< sobj > &extracted)
Definition
Tensor_extract_merge.h:96
thread_for
#define thread_for(i, num,...)
Definition
Threads.h:60
GridBase
Definition
Cartesian_base.h:43
GridBase::oSites
int oSites(void) const
Definition
Cartesian_base.h:185
GridBase::iSites
int iSites(void) const
Definition
Cartesian_base.h:183
Lattice
Definition
Lattice_base.h:47
Lattice::Grid
GridBase * Grid(void) const
Definition
Lattice_base.h:49
Grid
Definition
Deflation.h:31
scalar_type
Grid
lattice
Lattice_coordinate.h
Generated by
1.16.1