-
-
Save pgbarletta/6200a1c9150242c801aa1da951483c9f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cpp | |
// "called" is an object (functor) of the class "callback_for_boxes" | |
class callback_for_boxes { | |
public: | |
std::vector<size_t> *_id_vector_a, *_id_vector_b; | |
NA_Vector *_neighbors_a, *_neighbors_b; | |
callback_for_boxes(std::vector<size_t> &id_vector_a, | |
std::vector<size_t> &id_vector_b, NA_Vector &neighbors_a, | |
NA_Vector &neighbors_b) | |
: _id_vector_a(&id_vector_a), _id_vector_b(&id_vector_b), | |
_neighbors_a(&neighbors_a), _neighbors_b(&neighbors_b) {} | |
void operator()(const Box &a, const Box &b) { | |
// New boxes. Store their indices and their cells. | |
_id_vector_a->push_back(a.id()); | |
_id_vector_b->push_back(b.id()); | |
_neighbors_a->push_back(a.handle()); | |
_neighbors_b->push_back(b.handle()); | |
return; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment