Exemple #1
0
LRESULT CChecksumDialog::OnInitDialog(HWND hwndFocus, LPARAM lParam) 
{
	CComboBox cbx(GetDlgItem(IDC_CBX_ALGORITHM));
	if (cbx.IsWindow())
	{
		cbx.AddString(CString((LPCTSTR)IDS_ALGORITHM_MD5));
		cbx.AddString(CString((LPCTSTR)IDS_ALGORITHM_SHA1));
		cbx.AddString(CString((LPCTSTR)IDS_ALGORITHM_SHA256));
		cbx.AddString(CString((LPCTSTR)IDS_ALGORITHM_RIPEMD160));
		cbx.AddString(CString((LPCTSTR)IDS_ALGORITHM_WHIRLPOOL));
		cbx.SetCurSel(0);
	}

#ifdef UNICODE
	int nArgs;
	LPWSTR *szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);;
	if (szArglist)
	{
		if (nArgs == 2)
		{
			m_sFileName = szArglist[1];
			DoDataExchange(FALSE);
			OnCalculateChecksum(0, 0, NULL);
		}
		::LocalFree(szArglist);
	}	
#endif

	return 0;
}
void cb2(int tleid, int toval, short parm1, long parm2) {
    if (verbose)
        printf("cv2 signal\n");
    cbx(&t2, &cv2, tleid, toval, parm1, parm2);
}
void cb1(int tleid, int toval, short parm1, long parm2) {
    if (verbose)
        printf("cv1 signal\n");
    cbx(&t1, &cv1, tleid, toval, parm1, parm2);
}
Exemple #4
0
bool
ParticleBase::FineToCrse (const ParticleBase&                p,
                          int                                flev,
                          const ParGDBBase*                  gdb,
                          const Array<IntVect>&              fcells,
                          const BoxArray&                    fvalid,
                          const BoxArray&                    compfvalid_grown,
                          Array<IntVect>&                    ccells,
                          Array<Real>&                       cfracs,
                          Array<int>&                        which,
                          Array<int>&                        cgrid,
                          Array<IntVect>&                    pshifts,
                          std::vector< std::pair<int,Box> >& isects)
{
    BL_ASSERT(gdb != 0);
    BL_ASSERT(flev > 0);
    //
    // We're in AssignDensity(). We want to know whether or not updating
    // with a particle we'll cross a fine->crse boundary.  Note that crossing
    // a periodic boundary, where the periodic shift lies in our valid region,
    // is not considered a Fine->Crse crossing.
    //
    const int M = fcells.size();

    which.resize(M);
    cgrid.resize(M);
    ccells.resize(M);
    cfracs.resize(M);

    for (int i = 0; i < M; i++)
    {
        cgrid[i] = -1;
        which[i] =  0;
    }

    const Box& ibx = BoxLib::grow(gdb->ParticleBoxArray(flev)[p.m_grid],-1);

    BL_ASSERT(ibx.ok());

    if (ibx.contains(p.m_cell))
        //
        // We're strictly contained in our valid box.
        // We can't cross a fine->crse boundary.
        //
        return false;

    if (!compfvalid_grown.contains(p.m_cell))
        //
        // We're strictly contained in our "valid" region. Note that the valid
        // region contains any periodically shifted ghost cells that intersect
        // valid region.
        //
        return false;
    //
    // Otherwise ...
    //
    const Geometry& cgm = gdb->Geom(flev-1);
    const IntVect&  rr  = gdb->refRatio(flev-1);
    const BoxArray& cba = gdb->ParticleBoxArray(flev-1);

    ParticleBase::CIC_Cells_Fracs(p, cgm.ProbLo(), cgm.CellSize(), cfracs, ccells);

    bool result = false;

    for (int i = 0; i < M; i++)
    {
        IntVect ccell_refined = ccells[i]*rr;
        //
        // We've got to protect against the case when we're at the low
        // end of the domain because coarsening & refining don't work right
        // when indices go negative.
        //
        for (int dm = 0; dm < BL_SPACEDIM; dm++)
            ccell_refined[dm] = std::max(ccell_refined[dm], -1);

        if (!fvalid.contains(ccell_refined))
        {
            result   = true;
            which[i] = 1;

            Box cbx(ccells[i],ccells[i]);
    
            if (!cgm.Domain().contains(ccells[i]))
            {
                //
                // We must be at a periodic boundary.
                // Find valid box into which we can be periodically shifted.
                //
                BL_ASSERT(cgm.isAnyPeriodic());

                cgm.periodicShift(cbx, cgm.Domain(), pshifts);

                BL_ASSERT(pshifts.size() == 1);

                cbx -= pshifts[0];

                ccells[i] -= pshifts[0];
                BL_ASSERT(cbx.ok());
                BL_ASSERT(cgm.Domain().contains(cbx));
            }
            //
            // Which grid at the crse level do we need to update?
            //
            cba.intersections(cbx,isects,true);

            BL_ASSERT(!isects.empty());

            cgrid[i] = isects[0].first;  // The grid ID at crse level that we hit.
        }
    }

    return result;
}