Program Listing for File RestrictToRegion.cpp

Return to documentation for file (src/module/RestrictToRegion.cpp)

#include "crpropa/module/RestrictToRegion.h"

#include <sstream>

namespace crpropa {

RestrictToRegion::RestrictToRegion(Module* _module, Surface* _surface) : module(_module), surface(_surface) {
};

void RestrictToRegion::process(Candidate *candidate) const {
        if (surface->distance(candidate->current.getPosition()) <= 0) {
                module->process(candidate);
        }
};

std::string RestrictToRegion::getDescription() const {
        std::stringstream s;
        s << "RestrictToArea:\n"
                << "  Module: " << module->getDescription() << std::endl
                << "  Region: " << surface->getDescription() << std::endl;
        return s.str();
};


} // namespace crpropa