📄 lux_test1.cpp
字号:
// -*- C++ -*-
// ACL:license
// ----------------------------------------------------------------------
// This software and ancillary information (herein called "SOFTWARE")
// called POOMA (Parallel Object-Oriented Methods and Applications) is
// made available under the terms described here. The SOFTWARE has been
// approved for release with associated LA-CC Number LA-CC-98-65.
//
// Unless otherwise indicated, this SOFTWARE has been authored by an
// employee or employees of the University of California, operator of the
// Los Alamos National Laboratory under Contract No. W-7405-ENG-36 with
// the U.S. Department of Energy. The U.S. Government has rights to use,
// reproduce, and distribute this SOFTWARE, and to allow others to do so.
// The public may copy and use this SOFTWARE, FOR NONCOMMERCIAL USE ONLY,
// without charge, provided that this Notice and any statement of
// authorship are reproduced on all copies. Neither the Government nor
// the University makes any warranty, express or implied, or assumes any
// liability or responsibility for the use of this SOFTWARE.
//
// If SOFTWARE is modified to produce derivative works, such modified
// SOFTWARE should be clearly marked, so as not to confuse it with the
// version available from LANL.
//
// For more information about POOMA, send e-mail to pooma@acl.lanl.gov,
// or visit the POOMA web page at http://www.acl.lanl.gov/pooma/.
// ----------------------------------------------------------------------
// ACL:license
//-----------------------------------------------------------------------------
// Lux test 1: Display a 2D and a 3D fixed-size Array with Lux.
//-----------------------------------------------------------------------------
#include "Pooma/Pooma.h"
#include "Pooma/Lux.h"
#include "Pooma/Arrays.h"
#include "Pooma/DynamicArrays.h"
#include "Pooma/Domains.h"
#include "Utilities/Tester.h"
int main(int argc, char *argv[])
{
// Initialize POOMA and output stream, using Tester class
Pooma::initialize(argc, argv);
Pooma::Tester tester(argc, argv);
tester.out() << argv[0] << ": Lux Array display test" << std::endl;
tester.out() << "-----------------------------------" << std::endl;
// Arrays to display
Loc<3> blocks3D(1,2,2);
Interval<3> domain3D(32, 32, 64);
Interval<2> domain2D(100, 100);
Interval<1> domain1D(20);
GridLayout<3> layout3D(domain3D, blocks3D);
Array<3, double, MultiPatch<GridTag,Brick> > a3D(layout3D);
Array<2, int, Brick> a2D(domain2D);
DynamicArray<float, SharedBrick> a1D(domain1D);
// Initialize the arrays
a3D = 100 * (iota(domain3D).comp(2) + 1) +
10 * (iota(domain3D).comp(1) + 1) +
iota(domain3D).comp(0) + 1;
a2D = 1 + iota(domain2D).comp(1);
a1D = 1 + 10 * iota(domain1D).comp(0);
Pooma::blockAndEvaluate();
// Create a Lux connection
tester.out() << "Creating LuxConnection object ..." << std::endl;
Connection<Lux> lux("test1");
tester.out() << "Finished creating LuxConnection object." << std::endl;
// Establish connections for the two arrays; also connect up a view of
// the first array
tester.out() << "Connecting a3D for display ..." << std::endl;
lux.connect("a3D", a3D);
tester.out() << "Connecting a2D for display ..." << std::endl;
lux.connect("a2D", a2D);
tester.out() << "Connecting a1D for display ..." << std::endl;
lux.connect("a1D", a1D);
// Wait for everything to be ready to proceed
tester.out() << "Waiting for ready signal ..." << std::endl;
lux.ready();
tester.out() << "Ready complete, moving on." << std::endl;
// Do, in a loop, updates of the arrays, and redisplay/interact.
int myiters = 20;
while (myiters-- > 0)
{
tester.out() << "Incrementing for iters = " << myiters << std::endl;
a3D -= 1;
a2D += 1;
Pooma::blockAndEvaluate();
tester.out() << "Resizing dynamic for iters = " << myiters << std::endl;
a1D.create(5);
a1D = 1 + 10 * iota(a1D.domain()).comp(0);
Pooma::blockAndEvaluate();
tester.out() << "Updating for iters = " << myiters << std::endl;
lux.update();
tester.out() << "Interacting for iters = " << myiters << std::endl;
lux.interact();
}
// Delete LUX connection, closing the window.
tester.out() << "Closing LUX connection ..." << std::endl;
lux.close();
// Finish up and report results
tester.out() << "-------------------------------------------" << std::endl;
int retval = tester.results("Lux Array display test");
Pooma::finalize();
return retval;
}
// ACL:rcsinfo
// ----------------------------------------------------------------------
// $RCSfile: lux_test1.cpp,v $ $Author: bfh $
// $Revision: 1.1 $ $Date: 1999/09/17 00:06:58 $
// ----------------------------------------------------------------------
// ACL:rcsinfo
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -