本文整理汇总了C++中Display::display方法的典型用法代码示例。如果您正苦于以下问题:C++ Display::display方法的具体用法?C++ Display::display怎么用?C++ Display::display使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Display
的用法示例。
在下文中一共展示了Display::display方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
TestSorting test;
QTest::qExec(&test);
int mas1[5][5] = {{0, 1, 2, 3, 4},
{10,11,12,13,14},
{20,21,22,23,24},
{30,31,32,33,34},
{40,41,42,43,44}
};
Display *mas;
int p;
cout << " ƒл¤ вывода на консоль нажмите 1, дл¤ вывода в файл нажмите любую другую";
cin >> p;
if (p == 1)
{
mas = new DisplayMas();
mas->createMas(&mas1[0][0], 5);
mas->display();
}
else {
mas = new DisplayInFile();
mas->createMas(&mas1[0][0], 5);
mas->display();
}
delete mas;
return 0;
}
示例2: main
int main(int argc, char **argv)
{
Overture::start( argc, argv);
aString nameOfOGFile="Grids/test2d-cell4.hdf";
if( argc >1 ) {
nameOfOGFile = argv[1];
}
std::cout << argv[0] << " using grid="
<< nameOfOGFile << "..." << std::endl;
Display disp; //David's display
CompositeGrid cg;
getFromADataBase( cg, nameOfOGFile );
cg.update( MappedGrid::THEvertex | MappedGrid::THEcenter
| MappedGrid::THEvertexBoundaryNormal);
for( int ig=0; ig< cg.numberOfComponentGrids() ; ++ig ) {
MappedGrid &mg = cg[ig];
for( int side=0; side<2; ++side ) {
for( int axis=0; axis<cg.numberOfDimensions(); ++axis) {
realArray & normal = mg.vertexBoundaryNormal(side,axis);
printf("--grid %d, side %d, axis %d, bc %d--\n",
ig, side, axis, mg.boundaryCondition()(side,axis));
disp.display( normal );
}
}
}
Overture::finish();
}
示例3: testDisplay
//.........这里部分代码省略.........
////////////////////////////////////
temp = new string("Discard:");
out.push_back(temp);
////////////////////////////////////
temp = new string(" -1- -2- -3- -4-");
out.push_back(temp);
////////////////////////////////////
temp = new string("┌───┐ ┌───┐ ┌───┐ ┌───┐");
out.push_back(temp);
////////////////////////////////////
temp = new string("│ │ │ │ │ │ │ │");
out.push_back(temp);
////////////////////////////////////
temp = new string("└───┘ └───┘ └───┘ └───┘");
out.push_back(temp);
////////////////////////////////////
temp = new string("Stockpile:");
out.push_back(temp);
////////////////////////////////////
temp = new string("┌───┐");
out.push_back(temp);
////////////////////////////////////
temp = new string("│ 1 │");
*temp += " 1 cards left";
out.push_back(temp);
////////////////////////////////////
temp = new string("└───┘");
out.push_back(temp);
////////////////////////////////////
temp = new string("└Your Move: ");
out.push_back(temp);
for (unsigned long i = 0; i < out.size(); ++i) {
if (i == out.size()) {
correct << *(out.at(i));
}
else {
correct << *(out.at(i)) << endl;
}
}
for (int i = 0; i < (int) out.size(); ++i) {
delete out.at(i);
}
correct.close();
std::ofstream output("test.txt");
std::streambuf *coutbuf = std::cout.rdbuf();
cout.rdbuf(output.rdbuf());
vector<Build*> build;
Build* buildtemp = new Build();
build.push_back(buildtemp);
buildtemp = new Build();
build.push_back(buildtemp);
buildtemp = new Build();
build.push_back(buildtemp);
buildtemp = new Build();
build.push_back(buildtemp);
buildtemp = new Build();
build.push_back(buildtemp);
for (int i = 1; i < 12; ++i) *(build.at(0)) += i;
for (int i = 1; i < 6; ++i) *(build.at(1)) += i;
for (int i = 1; i < 2; ++i) *(build.at(3)) += i;
Stock* stock = new Stock();
Draw* draw = new Draw();
Player* player = new HumanPlayer("test", draw, &build, *stock);
player->drawCards();
player->hand.cards[0] = 1;
player->hand.cards[1] = 2;
player->hand.cards[2] = 3;
player->hand.cards[3] = 4;
player->hand.cards[4] = 10;
player->stock.cards.push_back(1);
Game game;
d.display(player, build, 1, &game);
char test[9] = {"test.txt"};
char corr[12] = {"correct.txt"};
assert(fileeq(test, corr));
cout.rdbuf(coutbuf);
for (int i = 0; i < (int) build.size(); ++i) delete build.at(i);
delete stock;
delete draw;
delete player;
}
示例4: dims
void FluxBC::
applyBoundaryCondition( realCompositeGridFunction &q,
int ic)
{
assert( pCg != NULL ); CompositeGrid &cg = *pCg;
assert( pInterp != NULL ); Interpolant &interp = *pInterp;
assert( pOp != NULL ); CompositeGridOperators &op = *pOp;
Display display; //David's display class
realArray &qTemp = q[0];
const int nComponents = qTemp.getLength(3); // indices ( 0, 1, 2, --3-- ), 3=component
const int nInterpComponents =valuesInterpolate.getLength(1);
assert( nComponents <= nInterpComponents );
if(debug&4)printf("***FluxBC::applyBC: nComponents %d, nInterpComponents %d, fluxCoeff %g\n",
nComponents, nInterpComponents, getFluxCoefficient());
//printf("FluxBC::applyBoundaryCondition called...\n");
timerInterpCode = getCPU();
interpolator.interpolatePoints(q,valuesInterpolate);
if(debug&8) {
printf("-------------------DISPLAY: valuesInterpolate in FluxBC::applyBoundaryCondition %d -------\n",
ic);
display.display(valuesInterpolate,"valuesInterpolate");
}
for ( int ig=0; ig< cg.numberOfComponentGrids(); ++ig ) {
MappedGrid & mg = cg[ig];
MappedGridOperators &opmg = op[ig];
realMappedGridFunction &q_mg = q[ig];
Index Ib1,Ib2,Ib3;
Index Ig1,Ig2,Ig3;
Index I1,I2,I3;
getIndex( mg.dimension(), I1,I2,I3);
//..flux/jump bc
const int nAxes=cg.numberOfDimensions();
int axis, side;
for( axis=0; axis<mg.numberOfDimensions(); axis++ ) {
for( side=0; side<=1; side++ ) {
if( mg.boundaryCondition()(side,axis) == idFluxBoundary ) {
//printf("FluxBC: grid, side, axis(%i,%i,%i) is a flux boundary (bc=%i)\n",
// ig,side,axis,idFluxBoundary);
getBoundaryIndex(mg.gridIndexRange(),side,axis,Ib1,Ib2,Ib3);
getGhostIndex(mg.gridIndexRange(),side,axis,Ig1,Ig2,Ig3);
realArray &qArray = q[ig];
int nInterpPoints= edgeEnd(ig,axis,side) - edgeStart(ig,axis,side)+1;
Range dims(0,nAxes-1);
//Range subset(edgeStart(ig,axis,side,edgeEnd(ig, axis,side)));
Range subset(edgeStart(ig,axis,side),edgeEnd(ig, axis,side));
realArray jump(nInterpPoints);
jump.reshape(subset);
jump(subset) = valuesInterpolate(subset,ic);
jump.reshape(Ib1,Ib2,Ib3, Range(ic,ic));
if(debug&8) {
printf("..grid %d, side %d, axis %d, component %d, flux coeff %g-- JUMP\n",
ig, side, axis, ic, getFluxCoefficient() );
display.display(jump,"jump: values for other grids");
}
jump = getFluxCoefficient()*( jump - qArray(Ib1,Ib2,Ib3,ic));
//if(debug&8 || (ic==1)) {
if(debug&8) {
printf("....Flux*[ jump ]\n");
display.display( jump, "flux coeff*[ other - this value]" );
}
//.. ibc chosen to set a specified boundary (side,axis)
// ... take jumps from unext --> impose as flux in u
const int ibc=BCTypes::boundary1+side+2*axis;
opmg.applyBoundaryCondition( q_mg, Range(ic,ic), BCTypes::neumann, ibc, jump );
if(debug&8) display.display(jump, "jump");
if(debug&16) display.display(qArray(I1,I2,I3,ic), "q function");
} // end if ibc==fluxBoundaryID
}
}
}
timerInterpCode = getCPU()-timerInterpCode;
}