Click here to Skip to main content
15,886,776 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.9K   4.1K   163  
Windows API, menus, C++ lambda expressions, std::enable_shared_from_this
#include "stdafx.h"

#include "hnum_slucmn.h"
namespace harlinn
{
    namespace numerics
    {
        namespace SuperLU
        {


            void pxgstrf_relax_snode(
		                const int n, /* number of columns in the matrix */
		                superlumt_options_t *superlumt_options,
		                pxgstrf_relax_t *pxgstrf_relax /* relaxed s-nodes */
		                )
            {
            /*
             * -- SuperLU MT routine (version 2.0) --
             * Lawrence Berkeley National Lab, Univ. of California Berkeley,
             * and Xerox Palo Alto Research Center.
             * September 10, 2007
             *
             * Purpose
             * =======
             *   pxgstrf_relax_snode() identifes the initial relaxed supernodes, 
             *   assuming that the matrix has been reordered according to the postorder
             *   of the etree.
             *
             */ 
                register int j, parent, rs;
                register int fcol;	 /* beginning of a snode */
                int *desc;  /* no of descendants of each etree node. */
                int *etree = superlumt_options->etree; /* column elimination tree */
                int relax = superlumt_options->relax; /* maximum no of columns allowed 
					                 in a relaxed s-node */
    
                desc = intCalloc(n+1);

                /* Compute the number of descendants of each node in the etree */
                for (j = 0; j < n; j++) {
	            parent = etree[j];
	            desc[parent] += desc[j] + 1;
                }
    
                rs = 1;
    
                /* Identify the relaxed supernodes by postorder traversal of the etree. */
                for (j = 0; j < n; ) { 
     	            parent = etree[j];
                    fcol = j;
 	            while ( parent != n && desc[parent] < relax ) {
	                j = parent;
	                parent = etree[j];
	            }
	            /* found a supernode with j being the last column. */
	            pxgstrf_relax[rs].fcol = fcol;
	            pxgstrf_relax[rs].size = j - fcol + 1;
            #ifdef DOMAINS
	            for (i = fcol; i <= j; ++i) in_domain[i] = RELAXED_SNODE;
            #endif
	            j++;    rs++;
	            /* Search for a new leaf */
	            while ( desc[j] != 0 && j < n ) j++;
                }

                pxgstrf_relax[rs].fcol = n;
                pxgstrf_relax[0].size = rs-1; /* number of relaxed supernodes */

            #if (PRNTlevel==1)
                printf(".. No of relaxed s-nodes %d\n", pxgstrf_relax[0].size);
            #endif
    
                SUPERLU_FREE (desc);

            }
        };
    };
};

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