MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / writeSets

Method writeSets

SRC/recorder/MPCORecorder.cpp:5855–5969  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5853}
5854
5855int MPCORecorder::writeSets()
5856{
5857#ifdef MPCO_TIMING
5858 mpco::Timer timer("writeSets"); timer.start();
5859#endif // MPCO_TIMING
5860 /*
5861 error flags
5862 */
5863 int retval = 0;
5864 herr_t status = 0;
5865 /*
5866 get all regions.
5867 note if the user is saving results not on the whole model, but only on a subset,
5868 the of each reagion we write only the nodes/elements contained in the subset
5869 and if the region (so modified) is empty, we skip it.
5870 */
5871 std::set<int> nset;
5872 std::set<int> eset;
5873 if (m_data->has_region) {
5874 // create ordered sets, search will be faster
5875 for (size_t i = 0; i < m_data->node_set.size(); i++)
5876 nset.insert(m_data->node_set[i]);
5877 for (size_t i = 0; i < m_data->elem_set.size(); i++)
5878 eset.insert(m_data->elem_set[i]);
5879 }
5880 ID tags;
5881 m_data->info.domain->getRegionTags(tags);
5882 if (tags.Size() > 0) {
5883 /*
5884 write the sets group
5885 */
5886 std::stringstream ss_gp_sets;
5887 ss_gp_sets << "MODEL_STAGE[" << m_data->info.current_model_stage_id << "]/MODEL/SETS";
5888 std::string gp_sets = ss_gp_sets.str();
5889 hid_t h_gp_sets = h5::group::create(m_data->info.h_file_id, gp_sets.c_str(), H5P_DEFAULT, m_data->info.h_group_proplist, H5P_DEFAULT);
5890 /*
5891 for each region
5892 */
5893 for (int i = 0; i < tags.Size(); i++) {
5894 /*
5895 get current region
5896 */
5897 MeshRegion *region = m_data->info.domain->getRegion(tags(i));
5898 if (region == NULL) continue;
5899 /*
5900 write the current set group
5901 */
5902 std::stringstream ss_gp_curr_set;
5903 ss_gp_curr_set << "SET_" << tags(i);
5904 std::string gp_curr_set = ss_gp_curr_set.str();
5905 hid_t h_gp_curr_set = h5::group::create(h_gp_sets, gp_curr_set.c_str(), H5P_DEFAULT, m_data->info.h_group_proplist, H5P_DEFAULT);
5906 /*
5907 write the current set NODES dataset
5908 */
5909 {
5910 const ID &nodes = region->getNodes();
5911 if (nodes.Size() > 0) {
5912 std::vector<int> aux;

Callers

nothing calls this directly

Calls 15

createAndWriteFunction · 0.85
closeFunction · 0.85
getNodesMethod · 0.80
push_backMethod · 0.80
stopMethod · 0.80
createFunction · 0.70
startMethod · 0.45
sizeMethod · 0.45
insertMethod · 0.45
getRegionTagsMethod · 0.45
SizeMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected