コード例 #1
0
ファイル: main.c プロジェクト: Howlinmoon/Hacking_With_C
void drawscr(void) {
    boxit(1,39,22,80);
    boxit(16,4,22,10);
    boxit(16,16,22,22);
    boxit(16,28,22,34);
    boxit(1,1,15,38);
    boxit(23,2,25,79);
    printat(1,53,"[ Main Map ]");
    printat(22,54,"[ Map # 1 ]");
    printat(1,6,"[ Comm-Bat Command Listing ]");
    printat(23,34,"[ Messages ]");
    printat(16,5,"[ D ]");
    printat(16,17,"[ B ]");
    printat(16,29,"[ T ]");
}
コード例 #2
0
ファイル: EBMGInterp.cpp プロジェクト: rsnemmen/Chombo
void
EBMGInterp::fillGhostCellsPWC(LevelData<EBCellFAB>& a_data,
                              const EBISLayout&     a_ebisl,
                              const ProblemDomain&  a_dom)
{
  for (int idir = 0; idir < SpaceDim; idir++)
    {
      if (m_ghost[idir] < 1)
        {
          MayDay::Error("EBMGInterp:I need a ghost cell for linear interpolation");
        }
    }
  //extrapolate to every ghost cell
  const DisjointBoxLayout& dbl = a_data.disjointBoxLayout();
  for (DataIterator dit = dbl.dataIterator(); dit.ok(); ++dit)
    {
      const Box& grid = dbl.get(dit());
      const EBGraph& ebgraph = a_ebisl[dit()].getEBGraph();
      for (int idir = 0; idir < SpaceDim; idir++)
        {
          for (SideIterator sit; sit.ok(); ++sit)
            {
              Side::LoHiSide flipSide = flip(sit());
              Box ghostBox = adjCellBox(grid, idir, sit(), 1);

              for (BoxIterator boxit(ghostBox); boxit.ok(); ++boxit)
                {
                  if (a_dom.contains(boxit()))
                    {
                      Vector<VolIndex> vofs = ebgraph.getVoFs(boxit());
                      for (int ivof = 0; ivof < vofs.size(); ivof++)
                        {
                          Real extrapVal = 0;
                          Vector<FaceIndex> faces = ebgraph.getFaces(vofs[ivof], idir, flipSide);
                          for (int ivar = 0; ivar < a_data.nComp(); ivar++)
                            {
                              for (int iface = 0; iface < faces.size(); iface++)
                                {
                                  const VolIndex& flipVoF = faces[iface].getVoF(flipSide);
                                  extrapVal += a_data[dit()](flipVoF, ivar);
                                }
                              if (faces.size() > 1) extrapVal /= faces.size();
                              a_data[dit()](vofs[ivof], ivar) = extrapVal;
                            }
                        }

                    }
                  else
                    {
                      //just put in the single valued part of the data holder something sensible
                      //if not inside domain
                      int isign = sign(flipSide);
                      BaseFab<Real>& bfdata = a_data[dit()].getSingleValuedFAB();
                      IntVect otherIV = boxit() + isign*BASISV(idir);
                      for (int ivar = 0; ivar < a_data.nComp(); ivar++)
                        {
                          bfdata(boxit(), ivar) = bfdata(otherIV, ivar);
                        }
                    }
                }
            }
        }
    }
  //do exchange to overwrite ghost cells where there exists real data
  a_data.exchange();
}
コード例 #3
0
ファイル: xmas.c プロジェクト: UnitedMarsupials/kame
void main()
{
 void done();
 int loopy;

  initscr();
  noecho();
  nonl();
  refresh();
  signal(SIGINT,done);
  signal(SIGTERM,done);
#if !defined	DOS && !defined OS2
  signal(SIGHUP,done);
  signal(SIGQUIT,done);
#endif



  treescrn = newwin(16,27,3,53);
  treescrn2 = newwin(16,27,3,53);
  treescrn3 = newwin(16,27,3,53);
  treescrn4 = newwin(16,27,3,53);
  treescrn5 = newwin(16,27,3,53);
  treescrn6 = newwin(16,27,3,53);
  treescrn7 = newwin(16,27,3,53);
  treescrn8 = newwin(16,27,3,53);

  dotdeer0 = newwin(3,71,0,8);

  stardeer0 = newwin(4,56,0,8);

  lildeer0 = newwin(7,53,0,8);
  lildeer1 = newwin(2,4,0,0);
  lildeer2 = newwin(2,4,0,0);
  lildeer3 = newwin(2,4,0,0);

  middeer0 = newwin(15,42,0,8);
  middeer1 = newwin(3,7,0,0);
  middeer2 = newwin(3,7,0,0);
  middeer3 = newwin(3,7,0,0);

  bigdeer0 = newwin(10,23,0,0);
  bigdeer1 = newwin(10,23,0,0);
  bigdeer2 = newwin(10,23,0,0);
  bigdeer3 = newwin(10,23,0,0);
  bigdeer4 = newwin(10,23,0,0);

  lookdeer0 = newwin(10,25,0,0);
  lookdeer1 = newwin(10,25,0,0);
  lookdeer2 = newwin(10,25,0,0);
  lookdeer3 = newwin(10,25,0,0);
  lookdeer4 = newwin(10,25,0,0);

  w_holiday = newwin(1,26,3,27);

  w_del_msg = newwin(1,12,23,60);

  mvwaddstr(w_del_msg,0,0,"Hit any key to quit");

  mvwaddstr(w_holiday,0,0,"H A P P Y  H O L I D A Y S");

  /* set up the windows for our various reindeer */

  /* lildeer1 */
  mvwaddch(lildeer1,0,0,(chtype)'V');
  mvwaddch(lildeer1,1,0,(chtype)'@');
  mvwaddch(lildeer1,1,1,(chtype)'<');
  mvwaddch(lildeer1,1,2,(chtype)'>');
  mvwaddch(lildeer1,1,3,(chtype)'~');

  /* lildeer2 */
  mvwaddch(lildeer2,0,0,(chtype)'V');
  mvwaddch(lildeer2,1,0,(chtype)'@');
  mvwaddch(lildeer2,1,1,(chtype)'|');
  mvwaddch(lildeer2,1,2,(chtype)'|');
  mvwaddch(lildeer2,1,3,(chtype)'~');

  /* lildeer3 */
  mvwaddch(lildeer3,0,0,(chtype)'V');
  mvwaddch(lildeer3,1,0,(chtype)'@');
  mvwaddch(lildeer3,1,1,(chtype)'>');
  mvwaddch(lildeer3,1,2,(chtype)'<');
  mvwaddch(lildeer2,1,3,(chtype)'~');


  /* middeer1 */
  mvwaddch(middeer1,0,2,(chtype)'y');
  mvwaddch(middeer1,0,3,(chtype)'y');
  mvwaddch(middeer1,1,2,(chtype)'0');
  mvwaddch(middeer1,1,3,(chtype)'(');
  mvwaddch(middeer1,1,4,(chtype)'=');
  mvwaddch(middeer1,1,5,(chtype)')');
  mvwaddch(middeer1,1,6,(chtype)'~');
  mvwaddch(middeer1,2,3,(chtype)'\\');
  mvwaddch(middeer1,2,4,(chtype)'/');

  /* middeer2 */
  mvwaddch(middeer2,0,2,(chtype)'y');
  mvwaddch(middeer2,0,3,(chtype)'y');
  mvwaddch(middeer2,1,2,(chtype)'0');
  mvwaddch(middeer2,1,3,(chtype)'(');
  mvwaddch(middeer2,1,4,(chtype)'=');
  mvwaddch(middeer2,1,5,(chtype)')');
  mvwaddch(middeer2,1,6,(chtype)'~');
  mvwaddch(middeer2,2,3,(chtype)'|');
  mvwaddch(middeer2,2,5,(chtype)'|');

  /* middeer3 */
  mvwaddch(middeer3,0,2,(chtype)'y');
  mvwaddch(middeer3,0,3,(chtype)'y');
  mvwaddch(middeer3,1,2,(chtype)'0');
  mvwaddch(middeer3,1,3,(chtype)'(');
  mvwaddch(middeer3,1,4,(chtype)'=');
  mvwaddch(middeer3,1,5,(chtype)')');
  mvwaddch(middeer3,1,6,(chtype)'~');
  mvwaddch(middeer3,2,2,(chtype)'/');
  mvwaddch(middeer3,2,6,(chtype)'\\');


  /* bigdeer1 */
  mvwaddch(bigdeer1,0,17,(chtype)'\\');
  mvwaddch(bigdeer1,0,18,(chtype)'/');
  mvwaddch(bigdeer1,0,20,(chtype)'\\');
  mvwaddch(bigdeer1,0,21,(chtype)'/');
  mvwaddch(bigdeer1,1,18,(chtype)'\\');
  mvwaddch(bigdeer1,1,20,(chtype)'/');
  mvwaddch(bigdeer1,2,19,(chtype)'|');
  mvwaddch(bigdeer1,2,20,(chtype)'_');
  mvwaddch(bigdeer1,3,18,(chtype)'/');
  mvwaddch(bigdeer1,3,19,(chtype)'^');
  mvwaddch(bigdeer1,3,20,(chtype)'0');
  mvwaddch(bigdeer1,3,21,(chtype)'\\');
  mvwaddch(bigdeer1,4,17,(chtype)'/');
  mvwaddch(bigdeer1,4,18,(chtype)'/');
  mvwaddch(bigdeer1,4,19,(chtype)'\\');
  mvwaddch(bigdeer1,4,22,(chtype)'\\');
  mvwaddstr(bigdeer1,5,7,"^~~~~~~~~//  ~~U");
  mvwaddstr(bigdeer1,6,7,"( \\_____( /");
  mvwaddstr(bigdeer1,7,8,"( )    /");
  mvwaddstr(bigdeer1,8,9,"\\\\   /");
  mvwaddstr(bigdeer1,9,11,"\\>/>");

  /* bigdeer2 */
  mvwaddch(bigdeer2,0,17,(chtype)'\\');
  mvwaddch(bigdeer2,0,18,(chtype)'/');
  mvwaddch(bigdeer2,0,20,(chtype)'\\');
  mvwaddch(bigdeer2,0,21,(chtype)'/');
  mvwaddch(bigdeer2,1,18,(chtype)'\\');
  mvwaddch(bigdeer2,1,20,(chtype)'/');
  mvwaddch(bigdeer2,2,19,(chtype)'|');
  mvwaddch(bigdeer2,2,20,(chtype)'_');
  mvwaddch(bigdeer2,3,18,(chtype)'/');
  mvwaddch(bigdeer2,3,19,(chtype)'^');
  mvwaddch(bigdeer2,3,20,(chtype)'0');
  mvwaddch(bigdeer2,3,21,(chtype)'\\');
  mvwaddch(bigdeer2,4,17,(chtype)'/');
  mvwaddch(bigdeer2,4,18,(chtype)'/');
  mvwaddch(bigdeer2,4,19,(chtype)'\\');
  mvwaddch(bigdeer2,4,22,(chtype)'\\');
  mvwaddstr(bigdeer2,5,7,"^~~~~~~~~//  ~~U");
  mvwaddstr(bigdeer2,6,7,"(( )____( /");
  mvwaddstr(bigdeer2,7,7,"( /      |");
  mvwaddstr(bigdeer2,8,8,"\\/      |");
  mvwaddstr(bigdeer2,9,9,"|>     |>");

  /* bigdeer3 */
  mvwaddch(bigdeer3,0,17,(chtype)'\\');
  mvwaddch(bigdeer3,0,18,(chtype)'/');
  mvwaddch(bigdeer3,0,20,(chtype)'\\');
  mvwaddch(bigdeer3,0,21,(chtype)'/');
  mvwaddch(bigdeer3,1,18,(chtype)'\\');
  mvwaddch(bigdeer3,1,20,(chtype)'/');
  mvwaddch(bigdeer3,2,19,(chtype)'|');
  mvwaddch(bigdeer3,2,20,(chtype)'_');
  mvwaddch(bigdeer3,3,18,(chtype)'/');
  mvwaddch(bigdeer3,3,19,(chtype)'^');
  mvwaddch(bigdeer3,3,20,(chtype)'0');
  mvwaddch(bigdeer3,3,21,(chtype)'\\');
  mvwaddch(bigdeer3,4,17,(chtype)'/');
  mvwaddch(bigdeer3,4,18,(chtype)'/');
  mvwaddch(bigdeer3,4,19,(chtype)'\\');
  mvwaddch(bigdeer3,4,22,(chtype)'\\');
  mvwaddstr(bigdeer3,5,7,"^~~~~~~~~//  ~~U");
  mvwaddstr(bigdeer3,6,6,"( ()_____( /");
  mvwaddstr(bigdeer3,7,6,"/ /       /");
  mvwaddstr(bigdeer3,8,5,"|/          \\");
  mvwaddstr(bigdeer3,9,5,"/>           \\>");

  /* bigdeer4 */
  mvwaddch(bigdeer4,0,17,(chtype)'\\');
  mvwaddch(bigdeer4,0,18,(chtype)'/');
  mvwaddch(bigdeer4,0,20,(chtype)'\\');
  mvwaddch(bigdeer4,0,21,(chtype)'/');
  mvwaddch(bigdeer4,1,18,(chtype)'\\');
  mvwaddch(bigdeer4,1,20,(chtype)'/');
  mvwaddch(bigdeer4,2,19,(chtype)'|');
  mvwaddch(bigdeer4,2,20,(chtype)'_');
  mvwaddch(bigdeer4,3,18,(chtype)'/');
  mvwaddch(bigdeer4,3,19,(chtype)'^');
  mvwaddch(bigdeer4,3,20,(chtype)'0');
  mvwaddch(bigdeer4,3,21,(chtype)'\\');
  mvwaddch(bigdeer4,4,17,(chtype)'/');
  mvwaddch(bigdeer4,4,18,(chtype)'/');
  mvwaddch(bigdeer4,4,19,(chtype)'\\');
  mvwaddch(bigdeer4,4,22,(chtype)'\\');
  mvwaddstr(bigdeer4,5,7,"^~~~~~~~~//  ~~U");
  mvwaddstr(bigdeer4,6,6,"( )______( /");
  mvwaddstr(bigdeer4,7,5,"(/          \\");
  mvwaddstr(bigdeer4,8,0,"v___=             ----^");


  /* lookdeer1 */
  mvwaddstr(lookdeer1,0,16,"\\/     \\/");
  mvwaddstr(lookdeer1,1,17,"\\Y/ \\Y/");
  mvwaddstr(lookdeer1,2,19,"\\=/");
  mvwaddstr(lookdeer1,3,17,"^\\o o/^");
  mvwaddstr(lookdeer1,4,17,"//( )");
  mvwaddstr(lookdeer1,5,7,"^~~~~~~~~// \\O/");
  mvwaddstr(lookdeer1,6,7,"( \\_____( /");
  mvwaddstr(lookdeer1,7,8,"( )    /");
  mvwaddstr(lookdeer1,8,9,"\\\\   /");
  mvwaddstr(lookdeer1,9,11,"\\>/>");

  /* lookdeer2 */
  mvwaddstr(lookdeer2,0,16,"\\/     \\/");
  mvwaddstr(lookdeer2,1,17,"\\Y/ \\Y/");
  mvwaddstr(lookdeer2,2,19,"\\=/");
  mvwaddstr(lookdeer2,3,17,"^\\o o/^");
  mvwaddstr(lookdeer2,4,17,"//( )");
  mvwaddstr(lookdeer2,5,7,"^~~~~~~~~// \\O/");
  mvwaddstr(lookdeer2,6,7,"(( )____( /");
  mvwaddstr(lookdeer2,7,7,"( /      |");
  mvwaddstr(lookdeer2,8,8,"\\/      |");
  mvwaddstr(lookdeer2,9,9,"|>     |>");

  /* lookdeer3 */
  mvwaddstr(lookdeer3,0,16,"\\/     \\/");
  mvwaddstr(lookdeer3,1,17,"\\Y/ \\Y/");
  mvwaddstr(lookdeer3,2,19,"\\=/");
  mvwaddstr(lookdeer3,3,17,"^\\o o/^");
  mvwaddstr(lookdeer3,4,17,"//( )");
  mvwaddstr(lookdeer3,5,7,"^~~~~~~~~// \\O/");
  mvwaddstr(lookdeer3,6,6,"( ()_____( /");
  mvwaddstr(lookdeer3,7,6,"/ /       /");
  mvwaddstr(lookdeer3,8,5,"|/          \\");
  mvwaddstr(lookdeer3,9,5,"/>           \\>");

  /* lookdeer4 */
  mvwaddstr(lookdeer4,0,16,"\\/     \\/");
  mvwaddstr(lookdeer4,1,17,"\\Y/ \\Y/");
  mvwaddstr(lookdeer4,2,19,"\\=/");
  mvwaddstr(lookdeer4,3,17,"^\\o o/^");
  mvwaddstr(lookdeer4,4,17,"//( )");
  mvwaddstr(lookdeer4,5,7,"^~~~~~~~~// \\O/");
  mvwaddstr(lookdeer4,6,6,"( )______( /");
  mvwaddstr(lookdeer4,7,5,"(/          \\");
  mvwaddstr(lookdeer4,8,0,"v___=             ----^");



  /***********************************************/
  cbreak();
  nodelay(stdscr,TRUE);
  do
  {
    clear();
    werase(treescrn);
    touchwin(treescrn);
    werase(treescrn2);
    touchwin(treescrn2);
    werase(treescrn8);
    touchwin(treescrn8);
    refresh();
    usleep(1000);
    boxit();
    refresh();
    usleep(1000);
    seas();
    refresh();
    usleep(1000);
    greet();
    refresh();
    usleep(1000);
    fromwho();
    refresh();
    usleep(1000);
    tree();
    usleep(1000);
    balls();
    usleep(1000);
    star();
    usleep(1000);
    strng1();
    strng2();
    strng3();
    strng4();
    strng5();


  /* set up the windows for our blinking trees */
  /* **************************************** */
  /* treescrn3 */

               overlay(treescrn, treescrn3);

             /*balls*/
               mvwaddch(treescrn3, 4, 18, ' ');
               mvwaddch(treescrn3, 7, 6, ' ');
               mvwaddch(treescrn3, 8, 19, ' ');
               mvwaddch(treescrn3, 11, 22, ' ');

             /*star*/
               mvwaddch(treescrn3, 0, 12, '*');

             /*strng1*/
               mvwaddch(treescrn3, 3, 11, ' ');

             /*strng2*/
               mvwaddch(treescrn3, 5, 13, ' ');
               mvwaddch(treescrn3, 6, 10, ' ');

             /*strng3*/
               mvwaddch(treescrn3, 7, 16, ' ');
               mvwaddch(treescrn3, 7, 14, ' ');

             /*strng4*/
               mvwaddch(treescrn3, 10, 13, ' ');
               mvwaddch(treescrn3, 10, 10, ' ');
               mvwaddch(treescrn3, 11, 8, ' ');

             /*strng5*/
               mvwaddch(treescrn3, 11, 18, ' ');
               mvwaddch(treescrn3, 12, 13, ' ');


  /* treescrn4 */

               overlay(treescrn, treescrn4);

             /*balls*/
               mvwaddch(treescrn4, 3, 9, ' ');
               mvwaddch(treescrn4, 4, 16, ' ');
               mvwaddch(treescrn4, 7, 6, ' ');
               mvwaddch(treescrn4, 8, 19, ' ');
               mvwaddch(treescrn4, 11, 2, ' ');
               mvwaddch(treescrn4, 12, 23, ' ');

             /*star*/
               wstandout(treescrn4);
               mvwaddch(treescrn4, 0, 12, '*');
               wstandend(treescrn4);

             /*strng1*/
               mvwaddch(treescrn4, 3, 13, ' ');

             /*strng2*/

	     /*strng3*/
               mvwaddch(treescrn4, 7, 15, ' ');
               mvwaddch(treescrn4, 8, 11, ' ');

             /*strng4*/
               mvwaddch(treescrn4, 9, 16, ' ');
               mvwaddch(treescrn4, 10, 12, ' ');
               mvwaddch(treescrn4, 11, 8, ' ');

             /*strng5*/
               mvwaddch(treescrn4, 11, 18, ' ');
	       mvwaddch(treescrn4, 12, 14, ' ');


  /* treescrn5 */

               overlay(treescrn, treescrn5);

             /*balls*/
               mvwaddch(treescrn5, 3, 15, ' ');
               mvwaddch(treescrn5, 10, 20, ' ');
               mvwaddch(treescrn5, 12, 1, ' ');

             /*star*/
               mvwaddch(treescrn5, 0, 12, '*');

             /*strng1*/
               mvwaddch(treescrn5, 3, 11, ' ');

             /*strng2*/
               mvwaddch(treescrn5, 5, 12, ' ');

             /*strng3*/
	       mvwaddch(treescrn5, 7, 14, ' ');
               mvwaddch(treescrn5, 8, 10, ' ');

             /*strng4*/
               mvwaddch(treescrn5, 9, 15, ' ');
               mvwaddch(treescrn5, 10, 11, ' ');
               mvwaddch(treescrn5, 11, 7, ' ');

             /*strng5*/
               mvwaddch(treescrn5, 11, 17, ' ');
               mvwaddch(treescrn5, 12, 13, ' ');

  /* treescrn6 */

               overlay(treescrn, treescrn6);

             /*balls*/
               mvwaddch(treescrn6, 6, 7, ' ');
               mvwaddch(treescrn6, 7, 18, ' ');
               mvwaddch(treescrn6, 10, 4, ' ');
               mvwaddch(treescrn6, 11, 23, ' ');

	     /*star*/
               wstandout(treescrn6);
               mvwaddch(treescrn6, 0, 12, '*');
               wstandend(treescrn6);

             /*strng1*/

             /*strng2*/
               mvwaddch(treescrn6, 5, 11, ' ');

             /*strng3*/
	       mvwaddch(treescrn6, 7, 13, ' ');
               mvwaddch(treescrn6, 8, 9, ' ');

             /*strng4*/
               mvwaddch(treescrn6, 9, 14, ' ');
               mvwaddch(treescrn6, 10, 10, ' ');
               mvwaddch(treescrn6, 11, 6, ' ');

             /*strng5*/
               mvwaddch(treescrn6, 11, 16, ' ');
               mvwaddch(treescrn6, 12, 12, ' ');

  /* treescrn7 */

               overlay(treescrn, treescrn7);

             /*balls*/
               mvwaddch(treescrn7, 3, 15, ' ');
               mvwaddch(treescrn7, 6, 7, ' ');
               mvwaddch(treescrn7, 7, 18, ' ');
               mvwaddch(treescrn7, 10, 4, ' ');
               mvwaddch(treescrn7, 11, 22, ' ');

             /*star*/
               mvwaddch(treescrn7, 0, 12, '*');

             /*strng1*/
               mvwaddch(treescrn7, 3, 12, ' ');

             /*strng2*/
               mvwaddch(treescrn7, 5, 13, ' ');
               mvwaddch(treescrn7, 6, 9, ' ');

	     /*strng3*/
               mvwaddch(treescrn7, 7, 15, ' ');
               mvwaddch(treescrn7, 8, 11, ' ');

             /*strng4*/
               mvwaddch(treescrn7, 9, 16, ' ');
               mvwaddch(treescrn7, 10, 12, ' ');
               mvwaddch(treescrn7, 11, 8, ' ');

             /*strng5*/
               mvwaddch(treescrn7, 11, 18, ' ');
	       mvwaddch(treescrn7, 12, 14, ' ');


    usleep(1000);
    reindeer();

    touchwin(w_holiday);
    wrefresh(w_holiday);
    wrefresh(w_del_msg);

    usleep(1000);
    for(loopy = 0;loopy < 100;loopy++)
    {
      blinkit();
    }

#ifdef NOLOOP
    done();
#endif

  }
  while(getch() == (ERR));
/*  while(!typeahead(stdin));*/
  done();
}