예제 #1
0
파일: snapshot.cpp 프로젝트: jorgehog/kMC
SnapShot::SnapShot(KMCSolver *solver)
{

    timeWhenTaken = time(NULL);
    seed = Seed::initialSeed;

    siteBox.set_size(solver->NX(), solver->NY(), solver->NZ());

    Site* currentSite;

    for (uint i = 0; i < siteBox.n_rows; ++i)
    {
        for (uint j = 0; j < siteBox.n_cols; ++j)
        {
            for (uint k = 0; k < siteBox.n_slices; ++k)
            {
                currentSite = solver->getSite(i, j, k);
                siteBox(i, j, k) = currentSite->isActive();

                if (currentSite->isActive())
                {
                    for (Reaction * r : currentSite->associatedParticle()->reactions())
                    {
                        allRates.push_back(r->rate());
                        allreactions.push_back({r->x(), r->y(), r->z(),
                                                ((DiffusionReaction*)r)->xD(),
                                                ((DiffusionReaction*)r)->yD(),
                                                ((DiffusionReaction*)r)->zD()});
                    }
                }

            }
        }
    }

}
예제 #2
0
    void execute()
    {
        uint clusterness = 0;
        uint N = 0;

        Site *currentSite;
        SoluteParticle *particle;

        for (uint x = 0; x < NX(); ++x)
        {
            for (uint y = 0; y < NY(); ++y)
            {
                currentSite = solver()->getSite(x, y, m_layerEvent->z());

                if (currentSite->isActive())
                {
                    N++;
                    particle = currentSite->associatedParticle();

                    for (int dx = -1; dx <= 1; ++dx)
                    {
                        for (int dy = -1; dy <= 1; ++dy)
                        {
                            if (dx == dy && dy == 0)
                            {
                                continue;
                            }

                            if (particle->neighborhood(dx, dy, 0)->isActive())
                            {
                                clusterness++;
                            }
                        }
                    }
                }
            }
        }

        setValue(clusterness/(double)N/8);

    }