Giter Site home page Giter Site logo

Comments (1)

sethrj avatar sethrj commented on May 27, 2024

From today's discussion of Propagator interface:

  • Both linear and magnetic field propagators will have two operator(), one with a maximum step distance, one without
  • Result of both operator() will be a struct returning the actual distance traveled, and (if it crossed into a new volume) the new updated volume ID
  • (Maybe?) If it moves outside, return an unassigned volume ID VolumeId{}
struct result_type
{
    real_type distance; //!< Distance traveled to min(input limit, boundary)
    VolumeId volume; //!< Post-propagation volume
};

// Input for propagation kernel: maximum distance to next physics interaction
// (or in the raytrace/rasterizing case, distance to next pixel)
result = propagate(limit) -> (distance actually traveled, VolumeId)
propagate(nolimit) -> (same)

// hit a new geometry volume *before* we hit limit:
result = {distance_traveled, geo.volume_id()};
// hit limit before hitting geometry boundary
result = {limit, VolumeId{}};
// no-limit case:
result = {distance_traveled, geo.inside() ? geo.volume_id() : VolumeId{}};

Hypothetical usage with an amazing goto:

__global__ void move_to_new_material(...)
{
    GeoTrackState geo(...);
    Propagator propagate(geo);
    MaterialTrackState mat(...);

    real_type physics_distance_limit = physics[thread_id];
    real_type accum_distance = 0;
    MaterialId matid = mat.id();

prop:
    auto result = propagate(physics_distance_limit);
    accum_distance += result.distance;
    if (result.volume)
    {
        // Moved to a new cell; check the new material
        if (volume_to_mat[result.volume.get()] == matid)
        {
            // Material didn't change; keep propagating
            physics_distance_limit -= result.distance;
            goto prop;
        }
    }

    return result.distance_traveled;
}

from celeritas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.