1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-08-03 05:07:07 +01:00

Global edit with change to View usage. autoView() creates a wrapper object that closes the view when scope closes.

This commit is contained in:
Peter Boyle
2020-06-05 18:52:35 -04:00
parent f39c2a240b
commit 1a4c8c3387
78 changed files with 773 additions and 778 deletions

View File

@@ -107,9 +107,8 @@ int main(int argc, char ** argv)
// Implement a stencil code that should agree with cshift!
for(int i=0;i<Check.Grid()->oSites();i++){
auto SE = gStencil.GetEntry(0,i);
auto check = Check.View(CpuWrite);
auto foo = Foo.View(CpuRead);
autoView(check, Check, CpuWrite);
autoView( foo, Foo, CpuRead);
// Encapsulate in a general wrapper
check[i] = foo[SE->_offset]; auto tmp=check[i];
if (SE->_permute & 0x1 ) { permute(check[i],tmp,0); tmp=check[i];}
@@ -147,8 +146,8 @@ int main(int argc, char ** argv)
}}}}
if (nrm > 1.0e-4) {
auto check = Check.View(CpuRead);
auto bar = Bar.View(CpuRead);
autoView( check , Check, CpuRead);
autoView( bar , Bar, CpuRead);
for(int i=0;i<check.size();i++){
std::cout << i<<" Check "<<check[i]<< "\n"<<i<<" Bar "<<bar[i]<<std::endl;
}