mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-13 01:05:36 +00:00
Namespace, indent
This commit is contained in:
parent
8aed4181e1
commit
c19ccdad7c
@ -1,4 +1,4 @@
|
|||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
@ -23,8 +23,8 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
|||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
See the full license in the file "LICENSE" in the top level distribution directory
|
See the full license in the file "LICENSE" in the top level distribution directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
#ifndef GRID_LATTICE_TRACE_H
|
#ifndef GRID_LATTICE_TRACE_H
|
||||||
#define GRID_LATTICE_TRACE_H
|
#define GRID_LATTICE_TRACE_H
|
||||||
|
|
||||||
@ -32,36 +32,35 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
|||||||
// Tracing, transposing, peeking, poking
|
// Tracing, transposing, peeking, poking
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
|
|
||||||
namespace Grid {
|
NAMESPACE_BEGIN(Grid);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Trace
|
// Trace
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
template<class vobj>
|
template<class vobj>
|
||||||
inline auto trace(const Lattice<vobj> &lhs)
|
inline auto trace(const Lattice<vobj> &lhs)
|
||||||
-> Lattice<decltype(trace(lhs._odata[0]))>
|
-> Lattice<decltype(trace(lhs._odata[0]))>
|
||||||
{
|
{
|
||||||
Lattice<decltype(trace(lhs._odata[0]))> ret(lhs._grid);
|
Lattice<decltype(trace(lhs._odata[0]))> ret(lhs._grid);
|
||||||
parallel_for(int ss=0;ss<lhs._grid->oSites();ss++){
|
parallel_for(int ss=0;ss<lhs._grid->oSites();ss++){
|
||||||
ret._odata[ss] = trace(lhs._odata[ss]);
|
ret._odata[ss] = trace(lhs._odata[ss]);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Trace Index level dependent operation
|
// Trace Index level dependent operation
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
template<int Index,class vobj>
|
template<int Index,class vobj>
|
||||||
inline auto TraceIndex(const Lattice<vobj> &lhs) -> Lattice<decltype(traceIndex<Index>(lhs._odata[0]))>
|
inline auto TraceIndex(const Lattice<vobj> &lhs) -> Lattice<decltype(traceIndex<Index>(lhs._odata[0]))>
|
||||||
{
|
{
|
||||||
Lattice<decltype(traceIndex<Index>(lhs._odata[0]))> ret(lhs._grid);
|
Lattice<decltype(traceIndex<Index>(lhs._odata[0]))> ret(lhs._grid);
|
||||||
parallel_for(int ss=0;ss<lhs._grid->oSites();ss++){
|
parallel_for(int ss=0;ss<lhs._grid->oSites();ss++){
|
||||||
ret._odata[ss] = traceIndex<Index>(lhs._odata[ss]);
|
ret._odata[ss] = traceIndex<Index>(lhs._odata[ss]);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NAMESPACE_END(Grid);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user