void dataLoad(std::istream & stream, SymmElasticityTensor & set, void * context) { dataLoad(stream, set._constant, context); dataLoad(stream, set._values_computed, context); dataLoad(stream, set._val, context); }
void dataLoad(std::istream & stream, SystemBase & system_base, void * context) { System & libmesh_system = system_base.system(); NumericVector<Real> & solution = *(libmesh_system.solution.get()); dataLoad(stream, solution, context); for (System::vectors_iterator it = libmesh_system.vectors_begin(); it != libmesh_system.vectors_end(); it++) dataLoad(stream, *(it->second), context); system_base.update(); }
/** * This routine takes the vector of byte buffers (one for each processor), deserializes them * into a series of FeatureSet objects, and appends them to the _feature_sets data structure. * * Note: It is assumed that local processor information may already be stored in the _feature_sets * data structure so it is not cleared before insertion. */ void FeatureFloodCount::deserialize(std::vector<std::string> & serialized_buffers) { // The input string stream used for deserialization std::istringstream iss; mooseAssert(serialized_buffers.size() == _app.n_processors(), "Unexpected size of serialized_buffers: " << serialized_buffers.size()); for (auto rank = decltype(_n_procs)(0); rank < serialized_buffers.size(); ++rank) { /** * We should already have the local processor data in the features data structure. * Don't unpack the local buffer again. */ if (rank == processor_id()) continue; iss.str(serialized_buffers[rank]); // populate the stream with a new buffer iss.clear(); // reset the string stream state // Load the communicated data into all of the other processors' slots dataLoad(iss, _partial_feature_sets, this); } }
void dataLoad(std::istream & stream, RankTwoTensor & rtt, void * context) { dataLoad(stream, rtt._vals, context); }
void dataLoad(std::istream & stream, std::stringstream * & s, void * context) { dataLoad(stream, *s, context); }
void dataLoad(std::istream & stream, RankFourTensor & rft, void * context) { dataLoad(stream, rft._vals, context); }
void dataLoad(std::istream & stream, MooseSharedPointer<FeatureFloodCount::FeatureData> & feature, void * context) { feature = MooseSharedPointer<FeatureFloodCount::FeatureData>(new FeatureFloodCount::FeatureData()); dataLoad(stream, *feature, context); }
void dataLoad(std::istream & stream, RankThreeTensor & rtht, void * context) { dataLoad(stream, rtht._vals, context); }
void RestartableTypesChecker::execute() { // First we need to check that the data has been restored properly checkData(); /** * For testing the packed range routines, we'll make sure that we can pack up several types * into a single string and send it as a packed range and successfully restore it. */ // Buffers for parallel communication std::vector<std::string> send_buffers(1); std::vector<std::string> recv_buffers; // String streams for serialization and deserialization std::ostringstream oss; std::istringstream iss; /** * Serialize */ dataStore(oss, _real_data, this); dataStore(oss, _vector_data, this); dataStore(oss, _vector_vector_data, this); dataStore(oss, _pointer_data, this); dataStore(oss, _custom_data, this); dataStore(oss, _set_data, this); dataStore(oss, _map_data, this); dataStore(oss, _dense_vector_data, this); dataStore(oss, _dense_matrix_data, this); send_buffers[0] = oss.str(); /** * Communicate */ recv_buffers.reserve(_app.n_processors()); _communicator.allgather_packed_range( (void *)(NULL), send_buffers.begin(), send_buffers.end(), std::back_inserter(recv_buffers)); if (recv_buffers.size() != _app.n_processors()) mooseError("Error in sizes of communicated buffers"); /** * Deserialize and check */ for (unsigned int i = 0; i < recv_buffers.size(); ++i) { iss.str(recv_buffers[i]); // reset the stream state iss.clear(); // Clear types (just to make sure we don't get any false positives in our testing) clearTypes(); // Now load the values dataLoad(iss, _real_data, this); dataLoad(iss, _vector_data, this); dataLoad(iss, _vector_vector_data, this); dataLoad(iss, _pointer_data, this); dataLoad(iss, _custom_data, this); dataLoad(iss, _set_data, this); dataLoad(iss, _map_data, this); dataLoad(iss, _dense_vector_data, this); dataLoad(iss, _dense_matrix_data, this); dataLoad(iss, *this, this); // Finally confirm that the data is sane checkData(); } }