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:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user