Пример #1
0
////// Private event management:
bool nuiContainer::DispatchMouseClick(const nglMouseInfo& rInfo)
{
  CheckValid();
  nuiAutoRef;
  if (!mMouseEventEnabled || mTrashed)
    return false;

  bool hasgrab = HasGrab(rInfo.TouchId);
  if (IsDisabled() && !hasgrab)
    return false;

  nglMouseInfo info(rInfo);
  GlobalToLocal(info.X, info.Y);

  // Get a chance to preempt the mouse event before the children get it:
  if (PreMouseClicked(info))
    return true;
  
  if (IsInsideFromRoot(rInfo.X, rInfo.Y) || hasgrab)
  {
    if (!hasgrab)
    {      
      IteratorPtr pIt;
      for (pIt = GetLastChild(false); pIt && pIt->IsValid(); GetPreviousChild(pIt))
      {
        nuiWidgetPtr pItem = pIt->GetWidget();
        if (pItem)
        {
          if (IsEnabled() && !HasGrab(rInfo.TouchId))
          {
            if (pItem->DispatchMouseClick(rInfo))
            {
              delete pIt;
              return true;
            }
          }
        }
      }
      delete pIt;
    }

    nglMouseInfo info(rInfo);
    GlobalToLocal(info.X, info.Y);
    if (PreClicked(info))
      return true;
    bool ret = MouseClicked(info);
    ret |= Clicked(info);
    return ret | (!mClickThru);
  }
  return false;
}
Пример #2
0
// --------------------------------------------------------------------------------------
void HandleContentClick(WindowRef window, Point mouseLocation, EventModifiers modifiers)
{
    ListHandle iconList;
    Rect iconListRect;
    Boolean isDoubleClick;
    Cell theCell;

    GetWindowProperty(window, kAppSignature, kIconListTag, sizeof(ListHandle), NULL,
                      &iconList);

    GetListViewBounds(iconList, &iconListRect);

    iconListRect.right += kScrollBarWidth;

    SetPortWindowPort(window);
    GlobalToLocal(&mouseLocation);

    if (PtInRect(mouseLocation, &iconListRect))
    {
        SInt16 pixelDepth;
        Boolean isColorDevice;

        GetWindowDeviceDepthAndColor(window, &pixelDepth, &isColorDevice);
        SetThemeBackground(kThemeBrushWhite, pixelDepth, isColorDevice);
        // if LClick causes the list selection to change, or the
        isDoubleClick = LClick(mouseLocation, modifiers, iconList);		// scroll bar
        SetPt(&theCell, 0, 0);					// to change, the affected cells are
        LGetSelect(true, &theCell, iconList);	// immediately drawn (no update event)

        if ((theCell.v + 1) != gPanelNumber)
            changePanel(window, theCell.v + 1);
    }
}
Пример #3
0
pascal OSStatus pxWindowNative::doMouseUp(EventHandlerCallRef nextHandler, EventRef theEvent, void* userData)
{
	pxWindowNative* w = (pxWindowNative*)userData;
	
	Point loc;
	UInt16 button;
	UInt32 modifier;
	
	GetEventParameter (theEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &loc);
	SetPort(GetWindowPort(w->mWindowRef));
	GlobalToLocal(&loc);
	GetEventParameter(theEvent, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button);
	GetEventParameter(theEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifier);	
	
	unsigned long flags = 0;

	if (button == kEventMouseButtonPrimary) flags |= PX_LEFTBUTTON;
	else if (button == kEventMouseButtonSecondary) flags |= PX_RIGHTBUTTON;
	else if (button == kEventMouseButtonTertiary) flags |= PX_MIDDLEBUTTON;
	
	if (modifier & shiftKey) flags |= PX_MOD_SHIFT;
	if (modifier & optionKey) flags |= PX_MOD_ALT;
	if (modifier & controlKey) flags |= PX_MOD_CONTROL;

	w->onMouseUp(loc.h, loc.v, flags);

	return CallNextEventHandler (nextHandler, theEvent);
}	
Пример #4
0
template <typename T> void MenuWidget<T>::ProcessDoubleTap(const InputEvent & InputEvent, Vector2n Position)
{
    if (nullptr != m_DoubleTapAction)
    {
        m_DoubleTapAction(GlobalToLocal(Position), m_Entries);
    }
}
Пример #5
0
template <typename T> void ListWidget<T>::ProcessTap(InputEvent & InputEvent, Vector2n Position)
{
	if (nullptr != m_TapAction)
	{
		m_TapAction(GlobalToLocal(Position), m_List);
	}
}
Пример #6
0
//------------------------------------------------------------------------
pascal OSStatus DoMouseUp (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData)
{
	Point wheresMyMouse;
	UInt32 modifier;
	
	GetEventParameter (theEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &wheresMyMouse);
	GlobalToLocal (&wheresMyMouse);
	GetEventParameter (theEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifier);

    platform_support * app = reinterpret_cast<platform_support*>(userData);

    app->m_specific->m_cur_x = wheresMyMouse.h;
    if(app->flip_y())
    {
        app->m_specific->m_cur_y = app->rbuf_window().height() - wheresMyMouse.v;
    }
    else
    {
        app->m_specific->m_cur_y = wheresMyMouse.v;
    }
    app->m_specific->m_input_flags = mouse_left | get_key_flags(modifier);

    if(app->m_ctrls.on_mouse_button_up(app->m_specific->m_cur_x, 
                                       app->m_specific->m_cur_y))
    {
        app->on_ctrl_change();
        app->force_redraw();
    }
    app->on_mouse_button_up(app->m_specific->m_cur_x, 
                            app->m_specific->m_cur_y, 
                            app->m_specific->m_input_flags);

	return CallNextEventHandler (nextHandler, theEvent);
}
Пример #7
0
pascal OSErr wxMacWindowDragReceiveHandler(WindowPtr theWindow,
                                           void *handlerRefCon,
                                           DragReference theDrag)
{ 
    MacTrackingGlobals* trackingGlobals = (MacTrackingGlobals*) handlerRefCon;
    if ( trackingGlobals->m_currentTarget )
    {
        Point mouse,localMouse ;
        int localx,localy ;
        
        trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag ) ;
        GetDragMouse(theDrag, &mouse, 0L);
        localMouse = mouse;
        GlobalToLocal(&localMouse);
        localx = localMouse.h ;
        localy = localMouse.v ;
        //TODO : should we use client coordinates
        if ( trackingGlobals->m_currentTargetWindow )
            trackingGlobals->m_currentTargetWindow->MacRootWindowToWindow( &localx , &localy ) ;
        if ( trackingGlobals->m_currentTarget->OnDrop( localx , localy ) )
        {
            KeyMap keymap;
            GetKeys(keymap);
            bool optionDown = keymap[1] & 4;
            wxDragResult result = optionDown ? wxDragCopy : wxDragMove;
            trackingGlobals->m_currentTarget->OnData( localx , localy , result ) ;
        }
    }
    return(noErr);
}
Пример #8
0
McoStatus DisplayDialog::DoEvents(short item, Point clickPoint, WindowCode *wc, int32 *numwc, void **data, Boolean &changed)
{
UserItemUPP myfilter;
Str255		theString;
short		itemtype;
Handle		cn1,sliderControl;
Rect		r;
short		part;
Point		mpoint;
int32		next_patch;
McoStatus	status;
WindowPtr	oldp;
int32		temp;
double 		m=1;

	GetPort(&oldp);
	SetPort(dp);

	Changed = FALSE;
	*numwc = 0;
	status = MCO_SUCCESS;

	if (isPressed(0x38)) m = 10;

	if (item != -1) {
		if (item == ids[Slider])   // the slider has been adjusted
			{
			GetMouse(&mpoint);
			do {
				current_patch = GetSlider(mpoint,ids[Slider]);
				ShowPatchScroll(current_patch);
				SetSheetStripText();
				current_sheet = current_patch/(patch_per_strip*strip_per_sheet);
				current_strip = (current_patch - current_sheet*(patch_per_strip*strip_per_sheet))/patch_per_strip;	
				GetMouse(&mpoint);
				} while ( StillDown ( ) );
			checkError((current_patch/patch_per_strip)*patch_per_strip);
			//_waiting = 0;
			Enable(dp,ids[Redo]);
			SetSheetStripText();
			}
		else if (item == ids[Strip_Rect])
			{
			GlobalToLocal(&clickPoint);
			temp = whichPatch(clickPoint);
			if (temp != -1)
				{
				current_patch = temp;
				current_disp = current_patch-current_top;
				GetDItem ( dp, ids[Slider], &itemtype, (Handle*)&sliderControl, &r );
				SetCtlValue ( (ControlHandle)sliderControl,current_patch);
				ShowPatch(current_patch);
				SetSheetStripText();
				}
			}
		}
	SetPort(oldp);
	return status;	    	
}
Пример #9
0
void GBWindow::AcceptUnclick(Point where, int clicksBefore) {
	GrafPtr savePort;
	GetPort(&savePort);
	SetPort(GetWindowPort(window));
	GlobalToLocal(&where);
	view->DoUnclick(where.h, where.v, clicksBefore);
	SetPort(savePort);
}
Пример #10
0
void GBWindow::AcceptDrag(Point where) {
	GrafPtr savePort;
	GetPort(&savePort);
	SetPort(GetWindowPort(window));
	GlobalToLocal(&where);
	view->DoDrag(where.h, where.v);
	SetPort(savePort);
}
Пример #11
0
static pascal Boolean device_dialog_filter_proc(
	DialogPtr dialog,
	EventRecord *event,
	short *item_hit)
{
	GrafPtr old_port;
	short item_type;
	Handle item_handle;
	Rect item_rectangle;
	boolean handled= FALSE;

	GetPort(&old_port);
	SetPort(dialog);
	
	GetDItem(dialog, iDEVICE_AREA, &item_type, &item_handle, &item_rectangle);

	/* preprocess events */	
	switch(event->what)
	{
		case mouseDown:
		{
			Point where= event->where;
			
			GlobalToLocal(&where);
			switch (FindDItem(dialog, where)+1)
			{
				case iDEVICE_AREA:
				{
					GDHandle new_device= click_in_device_area(&device_dialog_globals.device_spec, &item_rectangle, where);
					
					if (new_device && new_device!=device_dialog_globals.device)
					{
						device_dialog_globals.device= new_device;
						BuildExplicitGDSpec(&device_dialog_globals.device_spec, new_device, device_dialog_globals.device_spec.flags, device_dialog_globals.device_spec.bit_depth, 0, 0);
						draw_device_area(&device_dialog_globals.device_spec, device_dialog_globals.device, &item_rectangle);
						
						*item_hit= iDEVICE_AREA;
					}
					handled= TRUE;
					
					break;
				}
			}
			break;
		}
		
		case updateEvt:
			if ((DialogPtr)event->message==dialog)
			{
				draw_device_area(&device_dialog_globals.device_spec, device_dialog_globals.device, &item_rectangle);
			}
			break;
	}

	SetPort(old_port);

	return handled ? TRUE : general_filter_proc(dialog, event, item_hit);
}
Пример #12
0
void doEventLoop()
{
	EventRecord anEvent;
	WindowPtr   evtWind;
	short       clickArea;
	Rect        screenRect;
	Point		thePoint;
	Rect		zoomFrom, zoomTo;
	
	zoomFrom.top = zoomTo.top = -1;

	while (!gDone)
	{
		if (WaitNextEvent( everyEvent, &anEvent, 0, nil ))
		{
			if (anEvent.what == mouseDown)
			{
				clickArea = FindWindow( anEvent.where, &evtWind );
				
				if (clickArea == inDrag)
				{
					GetRegionBounds( GetGrayRgn(), &screenRect );
					DragWindow( evtWind, anEvent.where, &screenRect );
				}
				else if (clickArea == inContent)
				{
					if (evtWind != FrontWindow())
						SelectWindow( evtWind );
					else
					{
						thePoint = anEvent.where;
						GlobalToLocal( &thePoint );
						//Handle click in window content here
						GetRect(&zoomFrom, &zoomTo);
					}
				}
				else if (clickArea == inGoAway)
					if (TrackGoAway( evtWind, anEvent.where ))
						gDone = true;
			}
			else if (anEvent.what == updateEvt)
			{
				evtWind = (WindowPtr)anEvent.message;	
				SetPortWindowPort( evtWind );
				
				BeginUpdate( evtWind );
				//Call Draw Function here....
				if (zoomFrom.top != -1)
					FrameRect(&zoomFrom);
				if (zoomTo.top != -1)
					FrameRect(&zoomTo);
				EndUpdate (evtWind);
			}
		}
	}
}
Пример #13
0
// New doMyDeviceLoop, now works with multiple monitors
void doMyDeviceLoop()
{
	int				depth;
	Rect			gDeviceRect;
	Rect			intersectingRect;
	GDHandle		gDevice;
	//WindowRecord	*windowRec = (WindowRecord *)gWindow;
	WindowPtr		windowRec = gWindow;
	Rect			windowRect; //= (**windowRec->contRgn).rgnBBox;
	RgnHandle		rgnHandle = NewRgn();
	
	GetWindowRegion(windowRec, kWindowContentRgn, rgnHandle);
	GetRegionBounds(rgnHandle, &windowRect);

	// Get the handle to the first device in the list. 
	gDevice = GetDeviceList();

	// Loop through all the devices in the list. 
	while (gDevice != nil)
	{
		// Get the device's gdRect  */
		gDeviceRect = (**gDevice).gdRect;
		depth = (**(**gDevice).gdPMap).pixelSize;

		// Check if the app's window rect intersects the device's, and if it 
		// does, set the clip region's rect to the intersection, then DRAW! 
		if (SectRect( &windowRect, &gDeviceRect, &intersectingRect ))
		{
			// The intersectingRect is in global coords. Convert to local 
			GlobalToLocal((Point *)&intersectingRect.top);
			GlobalToLocal((Point *)&intersectingRect.bottom);

			ClipRect( &intersectingRect );
			doDraw( depth, &intersectingRect );
		}

		// Get the next device in the list. 
		gDevice = GetNextDevice( gDevice );
	}
	
	DisposeRgn(rgnHandle);
}
Пример #14
0
static Rboolean Quartz_Locator(double *x, double *y, NewDevDesc *dd)
{
    EventRecord event;
    SInt16 key;
    Boolean gotEvent;
    Boolean mouseClick = false;
    Point myPoint;
    WindowPtr window;
    SInt16 partCode;
    GrafPtr savePort;
    Cursor		arrow ;
    QuartzDesc *xd = (QuartzDesc*)dd->deviceSpecific;
	int useBeep = asLogical(GetOption(install("locatorBell"), 
						      R_NilValue));
	
    GetPort(&savePort);

    SetPortWindowPort(xd->window);
    SetThemeCursor(kThemeCrossCursor);

    while(!mouseClick) {
	
    
	gotEvent = WaitNextEvent( everyEvent, &event, 0, nil);

    CGContextFlush( GetContext(xd) );
   
	if (event.what == mouseDown) {
	    partCode = FindWindow(event.where, &window);
	    if ((window == (xd->window)) && (partCode == inContent)) {
			myPoint = event.where;
			GlobalToLocal(&myPoint);
			*x = (double)(myPoint.h);
			*y = (double)(myPoint.v);
			if(useBeep)
			 SysBeep(1);
			mouseClick = true;
	    }
	}

	if (event.what == keyDown) {
	    key = (event.message & charCodeMask);
	    if (key == 0x1b){ /* exits when the esc key is pressed */
			SetPort(savePort);
			SetThemeCursor(kThemeIBeamCursor);
			return FALSE;
	    }
	}
    }

    SetPort(savePort);
	SetThemeCursor(kThemeIBeamCursor);
    return TRUE;
}
Пример #15
0
/*** MAKE LOCAL ***/
void MakeLocal( WindowRef window, Point globalPoint, Point *localPoint )
{
	GrafPtr oldPort;
	GetPort( &oldPort );
	SetPortWindowPort( window );
	
	localPoint->h = globalPoint.h;
	localPoint->v = globalPoint.v;
	GlobalToLocal( localPoint );

	SetPort( oldPort );
}
Пример #16
0
static
void get_mouse(Point *mouse, EventModifiers *modifiers)
{
  EventRecord event;

  EventAvail(0, &event);

  *mouse = event.where;
  *modifiers = event.modifiers;

  GlobalToLocal(mouse);
}
Пример #17
0
void mac_clickeventlog(WindowPtr window, EventRecord *event)
{
    Session *s = mac_windowsession(window);
    Point mouse;
    GrafPtr saveport;

    GetPort(&saveport);
    SetPort((GrafPtr)GetWindowPort(window));
    mouse = event->where;
    GlobalToLocal(&mouse);
    LClick(mouse, event->modifiers, s->eventlog);
    SetPort(saveport);
}
Пример #18
0
bool nuiContainer::DispatchMouseCanceled(nuiWidgetPtr pThief, const nglMouseInfo& rInfo)
{
  CheckValid();
  nuiAutoRef;
  if (mTrashed)
    return false;

  bool hasgrab = HasGrab(rInfo.TouchId);

  nglMouseInfo info(rInfo);
  GlobalToLocal(info.X, info.Y);

  // Get a chance to preempt the mouse event before the children get it:
  PreClickCanceled(info);

  IteratorPtr pIt;
  for (pIt = GetLastChild(false); pIt && pIt->IsValid(); GetPreviousChild(pIt))
  {
    nuiWidgetPtr pItem = pIt->GetWidget();
    if (pItem)
    {
      pItem->DispatchMouseCanceled(pThief, rInfo);
    }
  }
  delete pIt;

  if (pThief != this)
  {
    GlobalToLocal(info.X, info.Y);
    PreClickCanceled(info);
    bool ret = MouseCanceled(info);
    ret |= ClickCanceled(info);
    ret = ret | (!mClickThru);
    return ret;
  }

  return false;
}
Пример #19
0
void nuiSlider::HookMouse()
{
  mClicked = true;
  mThumbClicked = true;
  mInteractiveValueChanged = true;
  Grab();
  Invalidate();
  mClickValue = mRange.GetValue();
  nglMouseInfo info;
  GetTopLevel()->GetMouseInfo(info);
  mClickX = info.X;
  mClickY = info.Y;
  GlobalToLocal(mClickX, mClickY);
}
Пример #20
0
void HandleMouseDown(EventRecord *event)
{
	short	part;
	WindowRef	window;
	MacWindow   *macwin;
	Rect		growRect={100,100,32000,32000};
	long		size;
	
	part=FindWindow(event->where, &window);
	macwin = (MacWindow*)GetWRefCon(window);
	
	switch(part)
	{
	case inMenuBar:
		mac_AdjustMenus(event->modifiers);
		mac_HandleMenuSelect(MenuSelect(event->where), event->modifiers);
		HiliteMenu(0);
		break;
	case inContent:
		SetPortWindowPort(window);
		SelectWindow(window);
		GlobalToLocal(&event->where);
		if(macwin) macwin->click(event->where, event->modifiers);
		break;
	case inDrag:
		DragWindow(window, event->where, &qd.screenBits.bounds);
		break;
	case inGrow:
		SetPortWindowPort(window);
		size=GrowWindow(window, event->where, &growRect);
		if( size )
		{
			SizeWindow(window, size&0x0000FFFF, size>>16, 0);
			EraseRect(&GetWindowPort(window)->portRect);
			InvalRect(&GetWindowPort(window)->portRect);
			if( macwin ) macwin->message(MW_GROW, size);
		}
		break;
	case inGoAway:
		if( TrackGoAway(window, event->where) ){
			if( macwin ){
				macwin->goaway(macwin);
			}
		}
		break;
	//case inZoomIn:
	//case inZoomOut:
	//	break;
	}
}
Пример #21
0
static void HandleCustomMouseDown(NavCBRecPtr callBackParms, CustomData *data)
{
	EventRecord *evt = callBackParms->eventData.eventDataParms.event;
	Point where = evt->where;
   
	GlobalToLocal(&where);
   
	ControlRef control = FindControlUnderMouse(where, callBackParms->window, NULL);
	if (control != NULL)
   {
      HandleControlClick(control, where, evt->modifiers, (ControlActionUPP)-1L);
                  NavCustomControl(callBackParms->context, kNavCtlBrowserRedraw, NULL);
               }
}
Пример #22
0
pascal OSStatus pxWindowNative::doMouseMove(EventHandlerCallRef nextHandler, EventRef theEvent, void* userData)
{
	pxWindowNative* w = (pxWindowNative*)userData;
	
	Point loc;
	
	GetEventParameter (theEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &loc);
	SetPort(GetWindowPort(w->mWindowRef));
	GlobalToLocal (&loc);
	
	
	w->onMouseMove(loc.h, loc.v);

	return CallNextEventHandler (nextHandler, theEvent);
}	
Пример #23
0
void DoClickInSrch(EventRecord e)
{
Point	pt = e.where;
short	which;

	SetPort(srchWind); GlobalToLocal(&pt);
	which = ((pt.v/12)*4)+(pt.h/37);
	if(!((which==63) && (SR_Cnt>64)))
		if(which<SR_Cnt) {
			if(e.modifiers & cmdKey)
				WP_InsertAddr(SR[which]);
			else
				DoEditMem(SR[which]);
		}
}
Пример #24
0
bool nuiWindowManager::DispatchMouseClick(const nglMouseInfo& rInfo)
{
  if (!IsEnabled())
    return false;

  if (IsInsideFromRoot(rInfo.X, rInfo.Y))
  {
    if (!mWindows.empty())
    {
      std::list<nuiWindow*>::iterator it;
      std::list<nuiWindow*>::iterator begin = mWindows.begin();
      it = mWindows.end();
      do 
      {
        it--;
        nuiWindow* win = *it;
        if (win->IsInsideFromRoot(rInfo.X, rInfo.Y))
        {
          if (GetActiveWindow() != win)
            ActivateWindow(win);
          break;
        }
      } while (it!=begin);
    }

    IteratorPtr pIt;
    for (pIt = GetLastChild(); pIt && pIt->IsValid(); GetPreviousChild(pIt))
    {
      nuiWidgetPtr pItem = pIt->GetWidget();
      if (pItem && pItem->IsVisible() && pItem->IsEnabled())
      {
        if (pItem->DispatchMouseClick(rInfo))
        {
          delete pIt;
          return true;
        }
      }
    }
    delete pIt;

    nglMouseInfo info(rInfo);
    GlobalToLocal(info.X, info.Y);
    bool ret = MouseClicked(info);
    ret |= Clicked(info);
    return ret;
  }
  return false;
}
Пример #25
0
        /**
         * Given a function \f$f(x)\f$ defined at the quadrature
         * points, this function determines the unknown global coefficients
         * \f$\boldsymbol{\hat{u}}^{\mathcal{H}}\f$ employing a discrete
         * Galerkin projection from physical space to coefficient
         * space. The operation is evaluated by the function #GlobalSolve using
         * the global mass matrix.
         *
         * The values of the function \f$f(x)\f$ evaluated at the
         * quadrature points \f$x_i\f$ should be contained in the
         * variable #m_phys of the ExpList object \a Sin. The resulting global
         * coefficients \f$\hat{u}_g\f$ are stored in the array #m_coeffs.
         *
         * @param   inarray     Discrete \f$f(x)\f$.
         * @param   outarray    Storage for result.
         * @param   coeffstate
         */
        void ContField1D::FwdTrans(const Array<OneD, const NekDouble> &inarray,
                                   Array<OneD,       NekDouble> &outarray,
                                   CoeffState coeffstate)
        {
            // Inner product of forcing
            Array<OneD,NekDouble> wsp(m_ncoeffs);
            IProductWRTBase(inarray,wsp,eGlobal);
            
            // Solve the system
            GlobalLinSysKey key(StdRegions::eMass, m_locToGloMap);

            GlobalSolve(key,wsp,outarray);
            if(coeffstate == eLocal)
            {
                GlobalToLocal(outarray,outarray);
            }
        }
Пример #26
0
        /**
         * Given the coefficients of an expansion, this function evaluates the
         * spectral/hp expansion \f$u^{\delta}(x)\f$ at the quadrature
         * points \f$x_i\f$. This operation is evaluated locally by the
         * function ExpList#BwdTrans.
         *
         * The coefficients of the expansion should be contained in the
         * variable #m_coeffs of the ExpList object \a In. The resulting
         * physical values at the quadrature points \f$u^{\delta}(x_i)\f$ are
         * stored in the array #m_phys.
         *
         * @param   In          An ExpList, containing the local
         *                      coefficients \f$\hat{u}_n^e\f$ in its array
         *                      #m_coeffs.
         */
        void ContField1D::BwdTrans(
                                const Array<OneD, const NekDouble>  &inarray,
                                Array<OneD,       NekDouble>  &outarray,
                                CoeffState coeffstate)
        {
            Array<OneD, NekDouble> tmpinarray;
            if(coeffstate != eLocal)
            {
                tmpinarray = Array<OneD, NekDouble>(inarray);
                GlobalToLocal(inarray,tmpinarray);
            }
            else
            {
                tmpinarray = inarray;
            }

            BwdTrans_IterPerExp(tmpinarray,outarray);
        }
Пример #27
0
 /**
  * This is equivalent to the operation:
  * \f[\boldsymbol{M\hat{u}}_g\f]
  * where \f$\boldsymbol{M}\f$ is the global matrix of type specified by
  * \a mkey. After scattering the global array \a inarray to local
  * level, this operation is evaluated locally by the function
  * ExpList#GeneralMatrixOp. The global result is then obtained by a
  * global assembly procedure.
  *
  * @param   mkey        This key uniquely defines the type matrix
  *                      required for the operation.
  * @param   inarray     The vector \f$\boldsymbol{\hat{u}}_g\f$ of size
  *                      \f$N_{\mathrm{dof}}\f$.
  * @param   outarray    The resulting vector of size
  *                      \f$N_{\mathrm{dof}}\f$.
  */
 void ContField1D::v_GeneralMatrixOp(
                         const GlobalMatrixKey                &gkey,
                         const Array<OneD,const NekDouble>    &inarray,
                               Array<OneD,      NekDouble>    &outarray,
                         CoeffState coeffstate)
 {
     if(coeffstate == eGlobal)
     {
         Array<OneD,NekDouble> tmp1(2*m_ncoeffs);
         Array<OneD,NekDouble> tmp2(tmp1+m_ncoeffs);
         GlobalToLocal(inarray,tmp1);
         GeneralMatrixOp_IterPerExp(gkey,tmp1,tmp2);
         Assemble(tmp2,outarray);
     }
     else
     {
         GeneralMatrixOp_IterPerExp(gkey,inarray,outarray);
     }
 }
Пример #28
0
        /**
         * Consider the one dimensional Helmholtz equation,
         * \f[\frac{d^2u}{dx^2}-\lambda u(x) = f(x),\f]
         * supplemented with appropriate boundary conditions (which are
         * contained in the data member #m_bndCondExpansions). Applying a
         * \f$C^0\f$ continuous Galerkin discretisation, this equation leads to
         * the following linear system:
         * \f[\left( \boldsymbol{M}+\lambda\boldsymbol{L}\right)
         * \boldsymbol{\hat{u}}_g=\boldsymbol{\hat{f}}\f]
         * where \f$\boldsymbol{M}\f$ and \f$\boldsymbol{L}\f$ are the mass and
         * Laplacian matrix respectively. This function solves the system above
         * for the global coefficients \f$\boldsymbol{\hat{u}}\f$ by a call to
         * the function #GlobalSolve.
         *
         * The values of the function \f$f(x)\f$ evaluated at the
         * quadrature points \f$\boldsymbol{x}_i\f$ should be contained in the
         * variable #m_phys of the ExpList object \a inarray. The resulting
         * global coefficients \f$\boldsymbol{\hat{u}}_g\f$ are stored in the
         * array #m_coeffs.
         *
         * @param   inarray     Input containing forcing function
         *                      \f$\boldsymbol{f}\f$ at the quadrature points.
         * @param   outarray    Output containing the coefficients
         *                      \f$\boldsymbol{u}_g\f$
         * @param   lambda      Parameter value.
         * @param   Sigma       Coefficients of lambda.
         * @param   varcoeff    Variable diffusivity coefficients.
         * @param   coeffstate 
         * @param   dirForcing  Dirichlet Forcing.
         */
        void ContField1D::v_HelmSolve(
                const Array<OneD, const NekDouble> &inarray,
                      Array<OneD,       NekDouble> &outarray,
                const FlagList &flags,
                const StdRegions::ConstFactorMap &factors,
                const StdRegions::VarCoeffMap &varcoeff,
                const Array<OneD, const NekDouble> &dirForcing)
        {
            // Inner product of forcing
            int contNcoeffs = m_locToGloMap->GetNumGlobalCoeffs();
            Array<OneD,NekDouble> wsp(contNcoeffs);
            IProductWRTBase(inarray,wsp,eGlobal);
            // Note -1.0 term necessary to invert forcing function to
            // be consistent with matrix definition
            Vmath::Neg(contNcoeffs, wsp, 1);

            // Forcing function with weak boundary conditions
            int i;
            for(i = 0; i < m_bndCondExpansions.num_elements(); ++i)
            {
                if(m_bndConditions[i]->GetBoundaryConditionType() != SpatialDomains::eDirichlet)
                {
                    wsp[m_locToGloMap->GetBndCondCoeffsToGlobalCoeffsMap(i)]
                        += m_bndCondExpansions[i]->GetCoeff(0);
                }
            }

            // Solve the system
            GlobalLinSysKey key(StdRegions::eHelmholtz,
                                m_locToGloMap,factors,varcoeff);

            if(flags.isSet(eUseGlobal))
            {
                GlobalSolve(key,wsp,outarray,dirForcing);
            }
            else
            {
                Array<OneD,NekDouble> tmp(contNcoeffs,0.0);
                GlobalSolve(key,wsp,tmp,dirForcing);
                GlobalToLocal(tmp,outarray);
            }
        }
Пример #29
0
void DoClickInWP(EventRecord e)
{
Point	pt = e.where;

	SetPort(wpWind); GlobalToLocal(&pt);

	if(pt.v<12)
		return;
	
	if(pt.v<396) {
		pt.v-=12;
		if(pt.h<33)							// left
			DoEditWPAddr((pt.v/12)+(wpCurPage*32));
		if((pt.h>32) && (pt.h<66))			// middle
			DoEditWPVal((pt.v/12)+(wpCurPage*32));
		if(pt.h>65)							// right
			DoEditWPText((pt.v/12)+(wpCurPage*32));
	} else
		wpCurPage = pt.h/33;

	WP_Update();
}
Пример #30
0
void DoClickInStat(EventRecord e)
{
#ifdef GB_DEBUG

Rect	boxes[6];
Point	pt = e.where;

	if(cart_data!=0L) {
		SetRect(&boxes[0], 40, 36, 74, 55);	SetRect(&boxes[1], 132, 36, 166, 55);
		SetRect(&boxes[2], 230, 36, 264, 55);	SetRect(&boxes[3], 40, 65, 74, 84);
		SetRect(&boxes[4], 132, 65, 166, 84);	SetRect(&boxes[5], 230, 65, 264, 84);
		SetPort(statWind); GlobalToLocal(&pt);
		
		for(short x=0;x<6;x++)
			if(PtInRect(pt, &boxes[x])) {
				DoEditReg(x);
				Stat_ForceUpdate();
			}
	}

#endif
}