本文整理汇总了C++中CoordBox::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ CoordBox::begin方法的具体用法?C++ CoordBox::begin怎么用?C++ CoordBox::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CoordBox
的用法示例。
在下文中一共展示了CoordBox::begin方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: grid
virtual void grid(GridType *grid)
{
CoordBox<2> box = grid->boundingBox();
grid->setEdge(ContainerCellType());
for (CoordBox<2>::Iterator i = box.begin(); i != box.end(); ++i) {
// IDs are derived from a counter. Resetting it ensures
// that the initializer will use the same ID for a
// particle on each node for any given container cell:
counter = 1 + i->toIndex(box.dimensions) * numCells;
ContainerCellType cell = grid->get(*i);
cell.clear();
grid->set(*i, cell);
if (*i == Coord<2>(0, 0)) {
// add a single cell with an influx of 1. this will
// make the whole system heat up over time.
addHeater(grid, Coord<2>(0, 0), FloatCoord<2>(0, 0), 0, 1);
}
addRandomCells(grid, *i, numCells);
}
fillGeometryData(grid);
}
示例2: grid
virtual void grid(GridBase<CELL, 3> *ret)
{
CoordBox<3> box = ret->boundingBox();
for (CoordBox<3>::Iterator i = box.begin(); i != box.end(); ++i) {
ret->at(*i) = CELL(*i);
}
}
示例3: grid
void Initializer::grid(LibGeoDecomp::GridBase<Cell, 2> *ret)
{
using LibGeoDecomp::CoordBox;
using LibGeoDecomp::FloatCoord;
boost::gil::rgb8_image_t img;
boost::gil::png_read_image(VANDOUKEN_DATA_DIR VANDOUKEN_INITIALIZER_IMG, img);
boost::gil::rgb8_image_t scaledImg(gridDimensions().x(), gridDimensions().y());
boost::gil::resize_view(
boost::gil::const_view(img)
, boost::gil::view(scaledImg)
, boost::gil::bilinear_sampler()
);
boost::gil::rgb8_image_t::const_view_t imgView = boost::gil::const_view(scaledImg);
CoordBox<2> box = ret->boundingBox();
for (CoordBox<2>::Iterator i = box.begin(); i != box.end(); ++i) {
bool setForce = false;
FloatCoord<2> force;
for (std::size_t j = 0; j < shapes.size(); ++j) {
shapes[j]->initCell(&force, &setForce, *i);
}
// force alpha channel to 0xff to ensure all particles are opaque
boost::gil::rgb8_image_t::value_type pixel = imgView(i->x(), i->y());
unsigned color = 0xff000000 +
(pixel[0] << 16) +
(pixel[1] << 8) +
(pixel[2] << 0);
ret->set(*i, Cell(color, *i, setForce, force, rand() % Cell::MAX_SPAWN_COUNTDOWN));
}
std::cout << "done ...\n";
}
示例4: grid
virtual void grid(GridBase<CELL_TYPE, 1> *ret)
{
CoordBox<1> boundingBox = ret->boundingBox();
for (CoordBox<1>::Iterator i = boundingBox.begin(); i != boundingBox.end(); ++i) {
CELL_TYPE cell(i->x() % width(), i->x() / width());
ret->set(*i, cell);
}
}
示例5: stepFinished
void stepFinished(const GridType& grid, unsigned step, WriterEvent event)
{
avrgTemperature = 0;
CoordBox<2> box = grid.boundingBox();
for (CoordBox<2>::Iterator i = box.begin(); i != box.end(); ++i) {
avrgTemperature += grid.get(*i).temperature;
}
avrgTemperature /= box.dimensions.prod();
std::cout << "averageTemperature(" << step << ") = " << avrgTemperature << "\n";
}
示例6: grid
virtual void grid(GridBase<BushFireCell, 2> *ret)
{
Random::seed(4711);
CoordBox<2> box = ret->boundingBox();
Grid<double> humidityGrid = createUnwarpedPlasmaField(gridDimensions(), 0.5);
Grid<double> fuelGrid = createUnwarpedPlasmaField(gridDimensions(), 0.01);
for (CoordBox<2>::Iterator i = box.begin(); i != box.end(); ++i) {
ret->set(*i, BushFireCell(humidityGrid[*i], 1.0 + fuelGrid[*i]));
}
CoordBox<2> seatOfFire(Coord<2>(100, 100), Coord<2>(10, 10));
for (CoordBox<2>::Iterator i = seatOfFire.begin(); i != seatOfFire.end(); ++i) {
if (box.inBounds(*i)) {
ret->set(*i, BushFireCell(0, 10.0, 200.0, BushFireCell::BURNING));
}
}
}