コード例 #1
0
void TimeSliceObservableCDT::process(const std::vector<Vertex*>& state) {
    // define a timelike direction that is the future
    Vertex* cur = state[0];
    Vertex* future = cur->getNeighbouringVertex();
    Triangle *f, *p;
    Vertex::getAdjacentTriangles(cur, future, &f, &p);
    if (!f->isTimelike(cur, future)) future = f->getThirdVertex(cur, future);

    for (unsigned int t = 0; t < T; t++) {
        unsigned int count = 0;

        // find spacelike loop at cur
        Vertex::getAdjacentTriangles(cur, future, &f, &p);
        VertSet n = cur->getSectorVertices(f, future, false);
        BOOST_ASSERT(n.size() == 1); // CDT constraint

        Vertex* prev = *n.begin();
        Vertex* lc = cur;
        do {
            VertSet sec = lc->getOtherSectorVertices(prev);
            BOOST_ASSERT(sec.size() == 1); // CDT constraint
            prev = lc;
            lc = *sec.begin();
            count++;
        } while (lc != cur);

        Vertex* newfut = *future->getOtherSectorVertices(cur).begin();
        cur = future;
        future = newfut;

        volumeProfile[t] = count;
    }
}
コード例 #2
0
ファイル: vert.cpp プロジェクト: nihil-momenti/cosc422-a2
VertSet intersection(const VertSet &set1, const VertSet &set2) {
    VertSet result = VertSet();
    for (VertSet_const_IT it = set1.begin(); it != set1.end(); it++) {
        if (set2.find(*it) != set2.end()) {
            result.insert(*it);
        }
    }
    return result;
}
コード例 #3
0
ファイル: BVGraph.hpp プロジェクト: sprax/cpp
    bool findDfsVertexPathRec(vector<Vertex*> &path, const Vertex *end) const
    {
        Vertex *lastVert = path.back();
        if (lastVert == end)
            return  true;

        if (mEdges.find(lastVert) != mEdges.end()) {
            VertSet *nexts = mEdges.at(lastVert);
            for (auto it = nexts->begin(); it != nexts->end(); ++it) {                
                path.push_back(*it);
                bool found = findDfsVertexPathRec(path, end);
                if ( found )
                    return found;
                else
                    path.pop_back();
            }
        }
        return false;
    }
コード例 #4
0
ファイル: BVGraph.hpp プロジェクト: sprax/cpp
    bool findDfsVertexPathMarkingRec(vector<Vertex*> &path, const Vertex *end)
    {
        Vertex *lastVert = path.back();
        if (lastVert == end)
            return  true;

        if (mEdges.find(lastVert) != mEdges.end()) {
            VertSet *nexts = mEdges.at(lastVert);
            for (VertSet::iterator it = nexts->begin(); it != nexts->end(); ++it) {
                Vertex *vert = *it;
                if (mMarks.find(vert) == mMarks.end()) {
                    mMarks.insert(vert);
                    path.push_back(vert);
                    bool found = findDfsVertexPathMarkingRec(path, end);
                    if ( found )
                        return found;
                    else
                        path.pop_back();
                }
            }
        }
        return false;
    }