示例#1
0
Dart SimplifTrian<PFP>::edgeCollapse(Dart d, typename PFP::VEC3& newPos)
{
    // store some darts
    Dart dd = m_map.phi2(d);
    Dart d1 = m_map.phi2(m_map.phi1(d));
    Dart d2 = m_map.phi2(m_map.phi_1(d));
    Dart dd1 = m_map.phi2(m_map.phi1(dd));
    Dart dd2 = m_map.phi2(m_map.phi_1(dd));

    // tag as dirty the critera that are associate to edges to be removed
    // and modified BUT NOT D
    Dart xd = d;
    do
    {
        CRIT* cr = getCrit(xd);
        cr->tagDirty();
        xd = m_map.phi2_1(xd);
    } while (xd != d);

    xd = m_map.phi2_1(dd); // phi2_1 pour ne pas repasser sur l'arete d/dd
    do
    {
        CRIT* cr = getCrit(xd);
        cr->tagDirty();
        xd = m_map.phi2_1(xd);
    } while (xd != dd);

    // store old valences
    int v_d = m_valences[d];
    int v_dd = m_valences[dd];

    // collapse the edge
    m_map.deleteFace(d);
    m_map.deleteFace(dd);
    m_map.sewFaces(d1, d2);
    m_map.sewFaces(dd1, dd2);

    // embed new vertex
    unsigned int emb = m_map.getEmbedding(d2, VERTEX);
    m_map.embedOrbit<VERTEX>(d2, emb);

    m_positions[d2] = newPos;
    m_valences[d2] = v_d + v_dd - 4;

    // update the valence of two incident vertices
    m_valences[d1]--;
    m_valences[dd1]--;

    return d2;
}
    /**
     * generate performance message for monitoring
     *
     * @param cpu - values for performance message
     *
     * @return string containing the generated performance message
     */
    string createPerformanceMessage( DataMapType const &dataMap ) const
    {
	unsigned long long warn = getWarn(), crit = getCrit();
        string msg = string("users=") + to_string(dataMap[ProveValueMapKey].as<AbsoluteThreshold>()) + ";" + to_string(warn) + ";" + to_string(crit) + ";0";

        return msg;
    }
    string createPerformanceMessage( DataMapType const &dataMap ) const
    {
        SizeThreshold const &warn = getWarn();
        SizeThreshold const &crit = getCrit();

        unsigned long long total = dataMap["total"].as<unsigned long long>();
        unsigned long long used = dataMap["used"].as<unsigned long long>();
        unsigned long long checkWarning = warn.is_rel() ? (unsigned long long)( warn.relative() * total ) : (unsigned long long)(warn.absolute());
        unsigned long long checkCritical = crit.is_rel() ? (unsigned long long)( crit.relative() * total ) : (unsigned long long)(crit.absolute());
        unsigned long long mb = 1024ULL * 1024;
        string const &mnt = dataMap["mnt"].as<string>();

        checkWarning /= mb;
        checkCritical /= mb;

        string msg = mnt + "=" + to_string( used / mb ) + "MB;"
                   + to_string(checkWarning) + ";"
                   + to_string(checkCritical) + ";0;"
                   + to_string(total / mb);

        return msg;
    }