//------------------------------+
//  DispWindow constructor      |
//------------------------------+
DispWindow::DispWindow( IWindow* dw) :
             IMultiCellCanvas( idwin,dw,dw)
{
  IPresSpaceHandle   hps;

  hps = IPresSpaceHandle();
  ICommandHandler::handleEventsFor( this );
  IMouseClickHandler::handleEventsFor( this );

  setColor(IColor(IColor::cyan));


  output = new IStaticText(DSP_ID,this,this);
  output->setText("OPENDOC+ICLUI");

  IFont tempFont;                       
  tempFont.setOutline(true);
  tempFont.setPointSize(15);
  tempFont.setName("Helv");
  output->setFont(tempFont);            
  output->setAlignment(IStaticText::centerRight);
  addToCell(output,1,1);
  setRowHeight(1,5,true);
  setColumnWidth(1,10,true);

  output->setAutoDeleteObject();
  setAutoDeleteObject();
}
/******************************************************************************
* Class AccountPage :: setCells - Set up your multicell canvas cells          *
******************************************************************************/
AccountPage& AccountPage::setCells()
{
/*-----------------------------------------------------------------------------
| Add the objects to your multicell canvas.                                   |
| Allow the container to expand horizontally.                                 |
| Allow the page buttons to expand horizontally.                              |
| Return yourself.                                                            |
-----------------------------------------------------------------------------*/
   addToCell( &userIdText,        2,  2 );
   addToCell( &userId,            2,  3 );

   addToCell( &nodeSysText,       2,  4 );
   addToCell( &nodeSys,           2,  5 );

   addToCell( pCnr,               2,  7,  3,  3 );
   addToCell( &pageCnrButtons,    5,  8 );
   setColumnWidth(                4,  0, true );

   addToCell( &pageButtons,       2, 10,  2,  3 );
   setColumnWidth(                3,  0, true );

   return *this;
};
//*****************************************************************************
// CLASS GeneralPage :: setCells() - set up the multi-cell canvas cells
//*****************************************************************************
GeneralPage&  GeneralPage :: setCells()
{
/*---------------------------------------------------------------------------
| Add objects to the multicell.                                             |
| Allow the entryfields to dynamically widen if the user enlarges the       |
| notebook.                                                                 |
---------------------------------------------------------------------------*/
   //                         col,row,col,row
   addToCell(&employeeIdText ,  2,  2);
   addToCell(&employeeId     ,  3,  2);
   setColumnWidth( 3, 2, true );

   addToCell(&lastNameText   ,  2,  4);
   addToCell(&lastName       ,  3,  4);
   setColumnWidth( 3, 2, true );

   addToCell(&firstNameText  ,  5,  4);
   addToCell(&firstName      ,  6,  4);
   setColumnWidth( 6, 2, true );

   addToCell(&middleNameText ,  8,  4,  2, 1);
   addToCell(&middleInitial  , 10,  4,  2, 1);

   addToCell(&intPhoneText    , 2,  6);
   addToCell(&intPhone        , 3,  6);
   setColumnWidth( 3, 2, true );

   addToCell(&extPhoneText    , 5,  6);
   addToCell(&extPhone        , 6,  6);
   setColumnWidth( 6, 2, true );

   addToCell(&roomText        , 2,  8);
   addToCell(&room            , 3,  8);
   setColumnWidth( 3, 2, true );

   addToCell(&bldgText        , 5,  8);
   addToCell(&building        , 6,  8);
   setColumnWidth( 6, 2, true );

   addToCell(&deptText        , 2, 10);
   addToCell(&deptName        , 3, 10);
   setColumnWidth( 3, 2, true );

   addToCell(&divText         , 5, 10);
   addToCell(&division        , 6, 10);
   setColumnWidth( 6, 2, true );

   addToCell(&employeeType    , 2, 12, 5, 5);

   addToCell(&mgrEmpNumText   , 2, 19);
   addToCell(&mgrEmpId        , 3, 19);
   setColumnWidth( 3, 2, true );

   addToCell(&mgrEmpNameText  , 5, 19);
   addToCell(&mgrName         , 6, 19);
   setColumnWidth( 6, 2, true );

   addToCell(&pageButtons     , 2, 21, 5, 4);

   return *this;
}
/*------------------------------------------------------------------------------
| Amp::Amp                                                                     |
|                                                                              |
|                                                                              |
------------------------------------------------------------------------------*/
Amp::Amp( IMMAmpMixer*  aAmp1,
          IMMAmpMixer*  aAmp2,
          IMMAmpMixer*  aAmp3,
          unsigned long windowid,
          IWindow*      parent,
          IWindow*      owner)
   : IMultiCellCanvas(windowid,parent,owner),
     name            (AMPNAMEID, this,owner),
     slVolume        (SL_VOLUME_ID,this,this,IRectangle(),
                      ICircularSlider::defaultStyle()
                      | ICircularSlider::proportionalTicks ),
     slBalance       (SL_BALANCE_ID,this,this,IRectangle(),
                      ICircularSlider::defaultStyle()
                      | ICircularSlider::proportionalTicks ),
     slBass          (SL_BASS_ID,this,this,IRectangle(),
                      ICircularSlider::defaultStyle()
                      | ICircularSlider::proportionalTicks ),
     slTreble        (SL_TREBLE_ID,this,this,IRectangle(),
                      ICircularSlider::defaultStyle()
                      | ICircularSlider::proportionalTicks ),
     slPitch         (SL_PITCH_ID,this,this,IRectangle(),
                      ICircularSlider::defaultStyle()
                      | ICircularSlider::proportionalTicks ),
     slGain          (SL_GAIN_ID,this,this,IRectangle(),
                      ICircularSlider::defaultStyle()
                      | ICircularSlider::proportionalTicks ),
     pAmpMixer1(aAmp1),
     pAmpMixer2(aAmp2),
     pAmpMixer3(aAmp3),
     ampHandler()
{
   IResourceLibrary reslib;

   //Set up the title
   name.setText(reslib.loadString(TITLE_MIXER));
   name.setForegroundColor     ( IColor(IColor::kRed)   );

   slVolume.setArmRange          (IRange(0,100));
   slVolume.setRotationIncrement (10);
   slVolume.setTickSpacing       (1);
   slVolume.setText              (reslib.loadString(STR_VOLUME));
   addToCell                     (&slVolume,     1, 1, 1, 1);

   slBalance.setArmRange         (IRange(0,100));
   slBalance.setRotationIncrement(10);
   slBalance.setTickSpacing      (1);
   slBalance.setText             (reslib.loadString(STR_BALANCE));
   addToCell                     (&slBalance,    2, 1, 1, 1);

   slBass.setArmRange            (IRange(0,100));
   slBass.setRotationIncrement   (10);
   slBass.setTickSpacing         (1);
   slBass.setText                (reslib.loadString(STR_BASS));
   addToCell                     (&slBass,       3, 1, 1, 1);

   slTreble.setArmRange          (IRange(0,100));
   slTreble.setRotationIncrement (10);
   slTreble.setTickSpacing       (1);
   slTreble.setText              (reslib.loadString(STR_TREBLE));
   addToCell                     (&slTreble,     4, 1, 1, 1);

   slPitch.setArmRange           (IRange(0,100));
   slPitch.setRotationIncrement  (10);
   slPitch.setTickSpacing        (1);
   slPitch.setText               (reslib.loadString(STR_PITCH));
   addToCell                     (&slPitch,      5, 1, 1, 1);

   slGain.setArmRange            (IRange(0,100));
   slGain.setRotationIncrement   (10);
   slGain.setTickSpacing         (1);
   slGain.setText                (reslib.loadString(STR_GAIN));
   addToCell                     (&slGain,       6, 1, 1, 1);

   addToCell                     (&name,         3, 2, 3, 1);

   ampHandler.handleEventsFor(this);
   IMMAmpMixer* tempAmp = 0;
   if (pAmpMixer3)
      tempAmp=pAmpMixer3;
   else if (pAmpMixer2)
      tempAmp=pAmpMixer2;
   else if (pAmpMixer1)
      tempAmp=pAmpMixer1;
   if (tempAmp)
   {
      slVolume.setValue (tempAmp->volume ());
      slBalance.setValue(tempAmp->balance());
      slBass.setValue   (tempAmp->bass   ());
      slTreble.setValue (tempAmp->treble ());
      slPitch.setValue  (tempAmp->pitch  ());
      slGain.setValue   (tempAmp->gain   ());
   } /* endif */
}
Beispiel #5
0
  void 
  GCellsShearing::runEvent(Particle& part, const double) const
  {
    Sim->dynamics->updateParticle(part);

    size_t oldCell(partCellData[part.getID()]);
    magnet::math::MortonNumber<3> oldCellCoords(oldCell);
    Vector oldCellPosition(calcPosition(oldCellCoords));

    //Determine the cell transition direction, its saved
    int cellDirectionInt(Sim->dynamics->
			 getSquareCellCollision3(part, oldCellPosition, cellDimension));
  
    size_t cellDirection = abs(cellDirectionInt) - 1;

    magnet::math::MortonNumber<3> endCell = oldCellCoords; //The ID of the cell the particle enters

    if ((cellDirection == 1) &&
	(oldCellCoords[1] == ((cellDirectionInt < 0) ? 0 : (cellCount[1] - 1))))
      {
	//We're wrapping in the y direction, we have to compute
	//which cell its entering
	endCell[1] = (endCell[1].getRealValue() + cellCount[1] 
		      + ((cellDirectionInt < 0) ?  -1 : 1)) % cellCount[1];

	//Remove the old x contribution
	//Calculate the final x value
	//Time till transition, assumes the particle is up to date
	double dt = Sim->dynamics->getSquareCellCollision2(part, oldCellPosition, cellDimension);
     
	//Predict the position of the particle in the x dimension
	Sim->dynamics->advanceUpdateParticle(part, dt);
	Vector tmpPos = part.getPosition();
	//This rewinds the particle again
	Sim->dynamics->updateParticle(part);

	//Adding this extra half cell ensures we get into the next
	//simulation image, to calculate the position of the new cell
	tmpPos[1] += ((cellDirectionInt < 0) ? -0.5 : 0.5) * cellDimension[1];

	//Determine the x position (in cell coords) of the particle and
	//add it to the endCellID
	Sim->BCs->applyBC(tmpPos, dt);
      
	endCell[0] = getCellID(tmpPos)[0];

	removeFromCell(part.getID());
	addToCell(part.getID(), endCell.getMortonNum());
      
	//Get rid of the virtual event that is next, update is delayed till
	//after all events are added
	Sim->ptrScheduler->popNextEvent();

	//Check the entire neighbourhood, could check just the new
	//neighbours and the extra LE neighbourhood strip but its a lot
	//of code
	if (isUsedInScheduler)
	  {
	    BOOST_FOREACH(const size_t& id2, getParticleNeighbours(part))
	      {
		Sim->ptrScheduler->addInteractionEvent(part, id2);

		BOOST_FOREACH(const nbHoodSlot& nbs, sigNewNeighbourNotify)
		  nbs.second(part, id2);
	      }
	  }
NSearch::NSearch(unsigned long windowId,IWindow* pOwnerParent,IFrameWindow* pSetFrame)
   : IMultiCellCanvas(windowId,pOwnerParent,pOwnerParent)
   , ICommandHandler()
   , ISelectHandler()
   // Search Notebook
   , nnbSearch      (ID_BOOK ,this,this)
   // .. page 1
   , imccSearchFor  (ID_PAGESEARCH ,&nnbSearch,&nnbSearch)

   , irbPersons     (ID_PERSONS    ,&imccSearchFor,&imccSearchFor,IRectangle(),RADIOSTYLE|IControl::group)
   , irbEvents      (ID_EVENTS     ,&imccSearchFor,&imccSearchFor,IRectangle(),RADIOSTYLE)

   , icbYesNoIn     (ID_YESNOIN    ,&imccSearchFor,&imccSearchFor,IRectangle(),COMBOSTYLE)
   , nynYesNo       (ID_YESNO      ,&imccSearchFor,&imccSearchFor)

   , icbTextIn      (ID_TEXTIN     ,&imccSearchFor,&imccSearchFor,IRectangle(),COMBOSTYLE)
   , nteText        (ID_TEXT       ,&imccSearchFor,&imccSearchFor)
   , irbSubString   (ID_TEXTSUBSTR ,&imccSearchFor,&imccSearchFor,IRectangle(),AUTORADIOSTYLE|IControl::group)
   , irbRegExp      (ID_TEXTREGEXP ,&imccSearchFor,&imccSearchFor,IRectangle(),AUTORADIOSTYLE)

   , icbNumberIn    (ID_NUMBERIN   ,&imccSearchFor,&imccSearchFor,IRectangle(),COMBOSTYLE)
   , nneNumber      (ID_NUMBER     ,&imccSearchFor,&imccSearchFor)
   , irbLess        (ID_NUMLESS    ,&imccSearchFor,&imccSearchFor,IRectangle(),AUTORADIOSTYLE|IControl::group)
   , irbEqual       (ID_NUMEQUAL   ,&imccSearchFor,&imccSearchFor,IRectangle(),AUTORADIOSTYLE)
   , irbMore        (ID_NUMMORE    ,&imccSearchFor,&imccSearchFor,IRectangle(),AUTORADIOSTYLE)

   , icbDateIn      (ID_DATEIN     ,&imccSearchFor,&imccSearchFor,IRectangle(),COMBOSTYLE)
   , ndcDate        (ID_DATE       ,&imccSearchFor,&imccSearchFor)

   // .. page 2
   , nlFound        (ID_PAGEFOUND  ,&nnbSearch)
   // Search Footer
   , ipbStart  (ID_START,this,this)
   , ipbStop   (ID_STOP ,this,this)
   , ipbClear  (ID_CLEAR,this,this)
   , ipbDone   (ID_DONE ,this,this)
   // Done
{
   // data setup
   pFrame=pSetFrame;
   setFont(IFont("Helv",8));
   // Handlers
   ICommandHandler::handleEventsFor(this);
   ISelectHandler::handleEventsFor(&irbPersons)
                  .handleEventsFor(&irbEvents);
   // layout
   nnbSearch.setPageBackgroundColor    (backgroundColor())
            .setMajorTabBackgroundColor(backgroundColor());
   INotebook::PageSettings page(INotebook::PageSettings::autoPageSize
                               |INotebook::PageSettings::majorTab);
   page.setTabText("Search for");
   nnbSearch.addLastPage(page,&imccSearchFor);
   page.setTabText("");
   nnbSearch.addLastPage(page,&nlFound);

   imccSearchFor.setDefaultCell(ISize(3,6));
   imccSearchFor
                .addToCell(&irbPersons  ,2, 2,1,1)
                .addToCell(&irbEvents   ,4, 2,3,1)

                .addToCell(&icbYesNoIn  ,2, 5,1,1)
                .addToCell(&nynYesNo    ,4, 5,3,1)

                .addToCell(&icbTextIn   ,2, 7,1,1)
                .addToCell(&nteText     ,4, 7,3,1)
                .addToCell(&irbSubString,4, 9,2,1)
                .addToCell(&irbRegExp   ,6, 9,1,1)

                .addToCell(&icbNumberIn ,2,11,1,1)
                .addToCell(&nneNumber   ,4,11,2,1)
                .addToCell(&irbLess     ,4,13,1,1)
                .addToCell(&irbEqual    ,5,13,1,1)
                .addToCell(&irbMore     ,6,13,1,1)

                .addToCell(&icbDateIn   ,2,15,1,1)
                .addToCell(&ndcDate     ,4,15,3,1)

                .setRowHeight(16,imccSearchFor.defaultCell().height(),False)
                .setColumnWidth(7,imccSearchFor.defaultCell().width(),False);

   irbPersons .click().setText("Persons");
   irbEvents  .setText("Events");

   IColor comboColor(223,223,223);
   icbYesNoIn .setLimit(20).setBackgroundColor(comboColor);
   icbTextIn  .setLimit(20).setBackgroundColor(comboColor);
   icbNumberIn.setLimit(20).setBackgroundColor(comboColor);

   irbSubString.click().setText("Substring");
   irbRegExp   .setText("RegExp").disable();

   irbLess    .setText("<");
   irbEqual   .select().setText("=");
   irbMore    .setText(">");

   icbDateIn  .setMinimumRows(min(icbDateIn  .count(),10)+1).setLimit(15).setBackgroundColor(comboColor);

   nlFound.addColumn("Person")
          .addColumn("Field");

   ipbStart.enableDefault().setText("Start");
   ipbStop .setText("Stop ");
   ipbClear.setText("Clear");
   ipbDone .setText("Done ");

   setDefaultCell(ISize(3,2));
   addToCell(&nnbSearch, 1, 1, 8);
   addToCell(&ipbStart     , 1, 3, 1);
   addToCell(&ipbStop      , 3, 3, 1);
   addToCell(&ipbClear     , 5, 3, 1);
   addToCell(&ipbDone      , 7, 3, 1);
   setColumnWidth(8, 0,True);
   setRowHeight  (1,16,True);
   // done
}
Beispiel #7
0
  void
  GCells::addCells(double maxdiam)
  {
    list.clear();
    partCellData.clear();
    NCells = 1;

    for (size_t iDim = 0; iDim < NDIM; iDim++)
      {
	cellCount[iDim] = int(Sim->primaryCellSize[iDim] 
			      / (maxdiam * (1.0 + 10 * std::numeric_limits<double>::epsilon())));
      
	if (cellCount[iDim] < 2 * overlink + 1)
	  cellCount[iDim] = 2 * overlink + 1;
	
	NCells *= cellCount[iDim];
      
	dilatedCellMax[iDim] = cellCount[iDim] - 1;
	cellLatticeWidth[iDim] = Sim->primaryCellSize[iDim] / cellCount[iDim];
	cellDimension[iDim] = cellLatticeWidth[iDim] + (cellLatticeWidth[iDim] - maxdiam) 
	  * lambda;
	cellOffset[iDim] = -(cellLatticeWidth[iDim] - maxdiam) * lambda * 0.5;
      }

    if (getMaxSupportedInteractionLength() < maxdiam)
      M_throw() << "The system size is too small to support the range of interactions specified (i.e. the system is smaller than the interaction diameter of one particle).";

    //Find the required size of the morton array
    magnet::math::MortonNumber<3> coords(cellCount[0], cellCount[1], cellCount[2]);
    size_t sizeReq = coords.getMortonNum();

    list.resize(sizeReq); //Empty Cells created!

    dout << "Cells <x,y,z> " << cellCount[0] << ","
	 << cellCount[1] << "," << cellCount[2]
	 << "\nCell Offset "
	 << cellOffset[0] / Sim->units.unitLength() << ","
	 << cellOffset[1] / Sim->units.unitLength() << ","
	 << cellOffset[2] / Sim->units.unitLength()
	 << "\nCells Dimension " 
	 << cellDimension[0] / Sim->units.unitLength()
	 << ","
	 << cellDimension[1] / Sim->units.unitLength()
	 << "," 
	 << cellDimension[2] / Sim->units.unitLength()
	 << "\nLattice spacing " 
	 << cellLatticeWidth[0] / Sim->units.unitLength()
	 << ","
	 << cellLatticeWidth[1] / Sim->units.unitLength()
	 << "," 
	 << cellLatticeWidth[2] / Sim->units.unitLength()
	 << "\nRequested supported length " << maxdiam / Sim->units.unitLength()
	 << "\nSupported length           " << getMaxSupportedInteractionLength() / Sim->units.unitLength()
	 << "\nVector Size <N>  " << sizeReq << std::endl;
  
    //Add the particles section
    //Required so particles find the right owning cell
    Sim->dynamics->updateAllParticles();
  
    ////Add all the particles 
    BOOST_FOREACH(const size_t& id, *range)
      {
	Particle& p = Sim->particles[id];
	Sim->dynamics->updateParticle(p); 
	addToCell(id);
	if (verbose)
	  {
	    boost::unordered_map<size_t, size_t>::iterator it = partCellData.find(id);
	    magnet::math::MortonNumber<3> currentCell(it->second);
	    
	    magnet::math::MortonNumber<3> estCell(getCellID(Sim->particles[ID].getPosition()));
	  
	    Vector wrapped_pos = p.getPosition();
	    for (size_t n = 0; n < NDIM; ++n)
	      {
		wrapped_pos[n] -= Sim->primaryCellSize[n] *
		  lrint(wrapped_pos[n] / Sim->primaryCellSize[n]);
	      }
	    Vector origin_pos = wrapped_pos + 0.5 * Sim->primaryCellSize - cellOffset;

	    derr << "Added particle ID=" << p.getID() << " to cell <"
		 << currentCell[0].getRealValue() 
		 << "," << currentCell[1].getRealValue()
		 << "," << currentCell[2].getRealValue()
		 << ">"
		 << "\nParticle is at this distance " << Vector(p.getPosition() - calcPosition(it->second, p)).toString() << " from the cell origin"
		 << "\nParticle position  " << p.getPosition().toString()	
		 << "\nParticle wrapped distance  " << wrapped_pos.toString()	
		 << "\nParticle relative position  " << origin_pos.toString()
		 << "\nParticle cell number  " << Vector(origin_pos[0] / cellLatticeWidth[0],
							 origin_pos[1] / cellLatticeWidth[1],
							 origin_pos[2] / cellLatticeWidth[2]
							 ).toString()
		 << std::endl;
	  }
      }

    dout << "Cell loading " << float(partCellData.size()) / NCells 
	 << std::endl;
  }