本文整理汇总了C++中Universe::addCell方法的典型用法代码示例。如果您正苦于以下问题:C++ Universe::addCell方法的具体用法?C++ Universe::addCell怎么用?C++ Universe::addCell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Universe
的用法示例。
在下文中一共展示了Universe::addCell方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clone
/**
* @brief Clones this Universe and all of the Cells within it and returns it
* @return a pointer to the Universe clone
*/
Universe* Universe::clone() {
log_printf(DEBUG, "Cloning Universe %d", _id);
/* Instantiate new Universe clone */
Universe* clone = new Universe(universe_id());
/* Loop over Cells in Universe and clone each one */
std::map<int, Cell*>::iterator iter1;
for (iter1 = _cells.begin(); iter1 != _cells.end(); ++iter1) {
/* If the Cell is filled with a Material, clone it */
if ((*iter1).second->getType() == MATERIAL) {
/* Clone the Cell */
CellBasic* parent = static_cast<CellBasic*>((*iter1).second);
CellBasic* cell_clone = parent->clone();
/* Add Cell clone to the list */
clone->addCell(cell_clone);
cell_clone->setUniverse(clone->getId());
}
/* Throw error message if Cell is FILL type */
else {
log_printf(ERROR, "Unable to clone Universe %d since it contains Cell %d"
"which is filled with a Universe rather than a Material");
}
}
return clone;
}
示例2: main
//.........这里部分代码省略.........
/* Create circles for the fuel as well as to discretize the moderator into
rings */
ZCylinder fuel_radius(0.0, 0.0, 0.54);
ZCylinder moderator_inner_radius(0.0, 0.0, 0.58);
ZCylinder moderator_outer_radius(0.0, 0.0, 0.62);
/* Create cells and universes */
log_printf(NORMAL, "Creating cells...");
/* Moderator rings */
Cell* moderator_ring1 = new Cell(21, "mod1");
Cell* moderator_ring2 = new Cell(1, "mod2");
Cell* moderator_ring3 = new Cell(2, "mod3");
moderator_ring1->setNumSectors(8);
moderator_ring2->setNumSectors(8);
moderator_ring3->setNumSectors(8);
moderator_ring1->setFill(materials["Water"]);
moderator_ring2->setFill(materials["Water"]);
moderator_ring3->setFill(materials["Water"]);
moderator_ring1->addSurface(+1, &fuel_radius);
moderator_ring1->addSurface(-1, &moderator_inner_radius);
moderator_ring2->addSurface(+1, &moderator_inner_radius);
moderator_ring2->addSurface(-1, &moderator_outer_radius);
moderator_ring3->addSurface(+1, &moderator_outer_radius);
/* UO2 pin cell */
Cell* uo2_cell = new Cell(3, "uo2");
uo2_cell->setNumRings(3);
uo2_cell->setNumSectors(8);
uo2_cell->setFill(materials["UO2"]);
uo2_cell->addSurface(-1, &fuel_radius);
Universe* uo2 = new Universe();
uo2->addCell(uo2_cell);
uo2->addCell(moderator_ring1);
uo2->addCell(moderator_ring2);
uo2->addCell(moderator_ring3);
/* 4.3% MOX pin cell */
Cell* mox43_cell = new Cell(4, "mox43");
mox43_cell->setNumRings(3);
mox43_cell->setNumSectors(8);
mox43_cell->setFill(materials["MOX-4.3%%"]);
mox43_cell->addSurface(-1, &fuel_radius);
Universe* mox43 = new Universe();
mox43->addCell(mox43_cell);
mox43->addCell(moderator_ring1);
mox43->addCell(moderator_ring2);
mox43->addCell(moderator_ring3);
/* 7% MOX pin cell */
Cell* mox7_cell = new Cell(5, "mox7");
mox7_cell->setNumRings(3);
mox7_cell->setNumSectors(8);
mox7_cell->setFill(materials["MOX-7%%"]);
mox7_cell->addSurface(-1, &fuel_radius);
Universe* mox7 = new Universe();
mox7->addCell(mox7_cell);
mox7->addCell(moderator_ring1);
mox7->addCell(moderator_ring2);
mox7->addCell(moderator_ring3);
/* 8.7% MOX pin cell */
Cell* mox87_cell = new Cell(6, "mox87");