Esempio n. 1
0
HRESULT
CNetSendProp::OnActivate (
    )
{
    CCombobox           NICs (m_hwnd, IDC_NIC) ;
    int                 iIndex ;
    INTERFACE_INFO *    pIfc ;
    DWORD               i ;

    //  setup the NICs

    ASSERT (g_NIC.IsInitialized ()) ;

    for (i = 0, pIfc = g_NIC [i] ;
         pIfc ;
         i++, pIfc = g_NIC [i]) 
    {

        if ((pIfc -> iiFlags & IFF_UP) &&
            (pIfc -> iiFlags & IFF_MULTICAST)) 
        {

            iIndex = NICs.Append (inet_ntoa (pIfc -> iiAddress.AddressIn.sin_addr)) ;
            if (iIndex == CB_ERR) {
                return E_FAIL ;
            }

            NICs.SetItemData (* (DWORD *) (& pIfc -> iiAddress.AddressIn.sin_addr), iIndex) ;
        }
    }

    //  wildcard
    iIndex = NICs.Append (ANY_IFC) ;
    if (iIndex == CB_ERR) {
        return E_FAIL ;
    }
    NICs.SetItemData (INADDR_ANY, iIndex) ;

    //  undefined
    iIndex = NICs.Append (UNDEFINED_STR) ;
    if (iIndex == CB_ERR) {
        return E_FAIL ;
    }
    NICs.SetItemData ((unsigned long) UNDEFINED, iIndex) ;

    Refresh_ () ;

    return S_OK ;
}
Esempio n. 2
0
bool UnitigGraph::RemoveLocalLowDepth(int min_depth, int min_len, int local_width, double local_ratio, int64_t &num_removed) {
    bool is_changed = false;
    bool need_refresh = false;

#pragma omp parallel for schedule(static, 1)
    for (vertexID_t i = 0; i < vertices_.size(); ++i) {
        if (vertices_[i].is_deleted || vertices_[i].length >= min_len) { continue; }
        assert(vertices_[i].length > 0);

        int indegree = sdbg_->Indegree(vertices_[i].start_node);
        int outdegree = sdbg_->Outdegree(vertices_[i].end_node);

        if (indegree + outdegree == 0) { continue; }

        if ((indegree <= 1 && outdegree <= 1) || indegree == 0 || outdegree == 0) {
            double depth = (double)vertices_[i].depth / vertices_[i].length;
            if (is_changed && depth > min_depth)
                continue;
            
            double mean = LocalDepth_(vertices_[i], local_width);
            double threshold = min_depth;
            if (min_depth < mean * local_ratio)
                is_changed = true;
            else
                threshold = mean * local_ratio;

            if (depth < threshold) {
                is_changed = true;
                need_refresh = true;
                vertices_[i].is_dead = true;
#pragma omp atomic
                ++num_removed;
            }
        }
    }

    if (need_refresh) {
        Refresh_();
    }

    return is_changed;
}