void run() { zeroeq::Subscriber subscriber(test::buildURI("127.0.0.1", *_publisher)); BOOST_CHECK(subscriber.subscribe( test::Echo::IDENTIFIER(), zeroeq::EventPayloadFunc([&](const void* data, const size_t size) { test::onEchoEvent(data, size); received = true; }))); // Using the connection broker in place of zeroconf BrokerPtr broker = createBroker(subscriber); BOOST_REQUIRE(broker.get()); if (!broker) return; _broker = broker->getAddress(); { std::unique_lock<std::mutex> lock(_mutex); _state = STATE_STARTED; _condition.notify_all(); } // test receive of data for echo event for (size_t i = 0; i < 10; ++i) { subscriber.receive(100); if (received) return; } BOOST_CHECK(!"reachable"); }
//---------------------------------------------------------------------------- fei::SharedPtr<fei::Vector> snl_fei::Factory::createVector(fei::SharedPtr<fei::MatrixGraph> matrixGraph, int numVectors) { matrixGraph_ = matrixGraph; if (matrixGraph_->getGlobalNumSlaveConstraints() > 0 && reducer_.get() == NULL) { reducer_ = matrixGraph_->getReducer(); } createBroker(matrixGraph_); return( broker_->createVector() ); }
//---------------------------------------------------------------------------- fei::SharedPtr<fei::Vector> snl_fei::Factory::createVector(fei::SharedPtr<fei::VectorSpace> vecSpace, int numVectors) { (void)vecSpace; fei::SharedPtr<fei::Vector> dummy; if (matrixGraph_.get() == NULL) { fei::console_out() << "snl_fei::Factory ERROR: when using LinearSystemCore or FiniteElementData" << ", you must create a MatrixGraph before you can create vectors"<<FEI_ENDL; return(dummy); } if (matrixGraph_->getGlobalNumSlaveConstraints() > 0 && reducer_.get() == NULL) { reducer_ = matrixGraph_->getReducer(); } createBroker(matrixGraph_); return( broker_->createVector() ); }
//---------------------------------------------------------------------------- fei::SharedPtr<fei::LinearSystem> snl_fei::Factory::createLinearSystem(fei::SharedPtr<fei::MatrixGraph>& matrixGraph) { matrixGraph_ = matrixGraph; if (matrixGraph_.get() == NULL) { fei::console_out() << "snl_fei::Factory ERROR: you may not create a LinearSystem with " << "a NULL MatrixGraph object." << FEI_ENDL; fei::SharedPtr<fei::LinearSystem> linsys; return(linsys); } if (matrixGraph_->getGlobalNumSlaveConstraints() > 0 && reducer_.get() == NULL) { reducer_ = matrixGraph_->getReducer(); } createBroker(matrixGraph_); broker_->setMatrixGraph(matrixGraph); return( broker_->createLinearSystem() ); }
//---------------------------------------------------------------------------- fei::SharedPtr<fei::Matrix> snl_fei::Factory::createMatrix(fei::SharedPtr<fei::MatrixGraph> matrixGraph) { matrixGraph_ = matrixGraph; fei::SharedPtr<fei::Matrix> mptr; if (matrixGraph_.get() == NULL) { fei::console_out() << "snl_fei::Factory ERROR: when using LinearSystemCore" << ", you must create a MatrixGraph before you can create matrices"<<FEI_ENDL; return(mptr); } if (matrixGraph_->getGlobalNumSlaveConstraints() > 0 && reducer_.get() == NULL) { reducer_ = matrixGraph_->getReducer(); } createBroker(matrixGraph_); broker_->setMatrixGraph(matrixGraph); return(broker_->createMatrix()); }