Skip to content

The Skeleton Level

Neon stencil containers: computing the grad of the level set field

Neon/tutorials/introduction/domainLevel/domainLevel.cpp
   // ...

    Neon::skeleton::Skeleton skl(data.getBackend());
    Neon::skeleton::Options  opt(occ, transfer);
    auto                     fR = data.getGrid().template newPatternScalar<T>();

    fR() = scalarVal;

    data.getBackend().syncAll();


    {  // SKELETON
        auto& X = data.getField(FieldNames::X);
        auto& Y = data.getField(FieldNames::Y);

        skl.sequence({UserTools::axpy(fR, Y, X),
                      UserTools::laplace(X, Y),
                      data.getGrid().dot("DotContainer", Y, Y, fR)},
                     appName, opt);

        skl.ioToDot(appName + "_" + Neon::skeleton::OccUtils::toString(opt.occ()));

        timer.start();
        for (int i = 0; i < nIterations; i++) {
            skl.run();
        }
        data.getBackend().syncAll();
        timer.stop();
    }