Click here to Skip to main content
15,886,046 members
Articles / Desktop Programming / Win32

Windows Development in C++, Working with Menus

Rate me:
Please Sign up or sign in to vote.
4.96/5 (60 votes)
3 Jan 2015CPOL19 min read 171.8K   4.1K   163  
Windows API, menus, C++ lambda expressions, std::enable_shared_from_this
#include "stdafx.h"

#include "hnum_pdsp_defs.h"
namespace harlinn
{
    namespace numerics
    {
        namespace SuperLU
        {
            namespace Double
            {

                void pdgstrf_mark_busy_descends(int pnum, int jcol, int *etree, pxgstrf_shared_t *pxgstrf_shared,int *bcol, int *lbusy)
                {
                /*
                 * -- SuperLU MT routine (version 1.0) --
                 * Univ. of California Berkeley, Xerox Palo Alto Research Center,
                 * and Lawrence Berkeley National Lab.
                 * August 15, 1997
                 *
                 * Purpose
                 * =======
                 *
                 *   Mark busy panels in local "lbusy" array, used for linear pipelining.
                 *
                 *   When jcol begins, its busy descendant panels (if any) are bcol and
                 *   all the e-tree ancestors of bcol between bcol and jcol. This routine
                 *   marks those columns in the array lbusy, which is local to this
                 *   processor, to preserve a snapshot regardless of what the other
                 *   processors are doing meanwhile.
                 *
                 * Arguments
                 * =========
                 *
                 * jcol    (input) int
                 *         Current panel, with leading column jcol.
                 *
                 * etree   (input) int*
                 *         Elimination tree parent pointers.
                 *
                 * bcol    (input/output) int*
                 *         Farthest busy descendant of jcol.
                 *         On entry, it is the first column of the farthest busy panel.
                 *         On exit, it may be adjusted to the first column of the
                 *                  farthest busy supernode.
                 *
                 * lbusy   (input/output) int*
                 *         Initially all -1, lbusy(r) = jcol means that r was busy
                 *         at the beginning of computing jcol.
                 *
                 */
                    GlobalLU_t *Glu = pxgstrf_shared->Glu;
                    register int w,  kcol, fsupc, bcol_reg;
                    int *xsup;

                    bcol_reg = *bcol;
                    if ( bcol_reg < jcol ) {
	
	                /* -----------------------------------------------------------
	                   Instead of waiting for the completion of "bcol", we can
	                   pessimistically assume supno[bcol] == supno[bcol-1],
	                   hence always mark as busy the supernode containing "bcol-1".
	                   ----------------------------------------------------------- */
	                if (pxgstrf_shared->pan_status[bcol_reg].type == RELAXED_SNODE) {
                #if 0	    
	                    if ( pdgstrf_shared->pan_status[bcol_reg].size < 0 )
	  	                fsupc = bcol_reg + pdgstrf_shared->pan_status[bcol_reg].size;
	                    else fsupc = bcol_reg;
                #endif
	                    fsupc = bcol_reg;
	                    w = pxgstrf_shared->pan_status[fsupc].size;
	                    bcol_reg += w;
	                    for (kcol = fsupc; kcol < bcol_reg; ++kcol)
		                lbusy[kcol] = jcol;
	                } else {
	                    /* Find leading column "fsupc" in the supernode that
	                       contains column "bcol-1" */
                #if 0
	                    if ( pdgstrf_shared->spin_locks[bcol_reg] ) /* WORSE PERFORMANCE!! */
		                await( &pdgstrf_shared->spin_locks[bcol_reg] );
                #endif
	                    xsup = Glu->xsup;
	                    fsupc = SUPER_FSUPC ( Glu->supno[bcol_reg-1] );
	                    for (kcol = fsupc; kcol < bcol_reg; ++kcol)	lbusy[kcol] = jcol;
	                }
	
                #if ( DEBUGlevel>=1 )
                if (jcol >= LOCOL && jcol <= HICOL)
                    printf("(%d) mark_busy_descends[1] jcol %d, bcol_reg %d, fsupc %d\n",
                           pnum, jcol, bcol_reg, fsupc);
                #endif
	
	                /* Mark as busy all columns on the path between bcol_reg and jcol */
	                for (kcol = bcol_reg; kcol < jcol; kcol = etree[kcol]) {
	                    lbusy[kcol] = jcol;
	                }

	                /* INVARIANT: *bcol must be the first column of the farthest
	                   busy supernode */
	                *bcol = fsupc;
			 
                    } /* if bcol_reg < jcol */
                }


            };
        };
    };
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect Sea Surveillance AS
Norway Norway
Chief Architect - Sea Surveillance AS.

Specializing in integrated operations and high performance computing solutions.

I’ve been fooling around with computers since the early eighties, I’ve even done work on CP/M and MP/M.

Wrote my first “real” program on a BBC micro model B based on a series in a magazine at that time. It was fun and I got hooked on this thing called programming ...

A few Highlights:

  • High performance application server development
  • Model Driven Architecture and Code generators
  • Real-Time Distributed Solutions
  • C, C++, C#, Java, TSQL, PL/SQL, Delphi, ActionScript, Perl, Rexx
  • Microsoft SQL Server, Oracle RDBMS, IBM DB2, PostGreSQL
  • AMQP, Apache qpid, RabbitMQ, Microsoft Message Queuing, IBM WebSphereMQ, Oracle TuxidoMQ
  • Oracle WebLogic, IBM WebSphere
  • Corba, COM, DCE, WCF
  • AspenTech InfoPlus.21(IP21), OsiSoft PI


More information about what I do for a living can be found at: harlinn.com or LinkedIn

You can contact me at espen@harlinn.no

Comments and Discussions