diff --git a/src/vt/topos/location/location.h b/src/vt/topos/location/location.h index bb7d6eefae..fec0849067 100644 --- a/src/vt/topos/location/location.h +++ b/src/vt/topos/location/location.h @@ -237,6 +237,14 @@ struct EntityLocationCoord : LocationCoord { MsgSharedPtr const& msg ); + /** + * \brief Route a message with a custom handler where the element is local + * + * \param[in] m message shared pointer + */ + template + void routeMsgHandlerLocal(MsgSharedPtr const& msg); + /** * \brief Route a message to the default handler * diff --git a/src/vt/topos/location/location.impl.h b/src/vt/topos/location/location.impl.h index 52cbada83f..22fff5a6ab 100644 --- a/src/vt/topos/location/location.impl.h +++ b/src/vt/topos/location/location.impl.h @@ -668,7 +668,22 @@ void EntityLocationCoord::routeMsgHandler( # endif msg->setHandler(handler); - return routeMsg(id,home_node,msg); + + if (local_registered_.find(id) == local_registered_.end()) { + return routeMsg(id,home_node,msg); + } else { + return routeMsgHandlerLocal(msg); + } +} + +template +template +void EntityLocationCoord::routeMsgHandlerLocal( + MsgSharedPtr const& msg +) { + runnable::makeRunnable(msg, true, msg->getHandler(), theContext()->getNode()) + .withTDEpochFromMsg() + .run(); } template