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

Method writeModelElements

SRC/recorder/MPCORecorder.cpp:5123–5221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5121}
5122
5123int MPCORecorder::writeModelElements()
5124{
5125#ifdef MPCO_TIMING
5126 mpco::Timer timer("writeModelElements"); timer.start();
5127#endif // MPCO_TIMING
5128 /*
5129 error flags
5130 */
5131 int retval = 0;
5132 herr_t status = 0;
5133 /*
5134 create element group
5135 */
5136 std::stringstream ss_gp_elements_dir;
5137 ss_gp_elements_dir << "MODEL_STAGE[" << m_data->info.current_model_stage_id << "]/MODEL/ELEMENTS";
5138 std::string gp_elements_dir = ss_gp_elements_dir.str();
5139 hid_t h_gp_elements = h5::group::create(m_data->info.h_file_id, gp_elements_dir.c_str(), H5P_DEFAULT, m_data->info.h_group_proplist, H5P_DEFAULT);
5140 /*
5141 map all elements
5142 */
5143 m_data->elements.mapElements(m_data->info.domain, m_data->has_region, m_data->elem_set);
5144 /*
5145 loop over all element group-by-tag
5146 */
5147 for (mpco::element::ElementCollection::submap_type::iterator it1 = m_data->elements.items.begin();
5148 it1 != m_data->elements.items.end(); ++it1) {
5149 mpco::element::ElementWithSameClassTagCollection &elem_by_tag = it1->second;
5150 /*
5151 loop over all element group-by-integration rule
5152 */
5153 for (mpco::element::ElementWithSameClassTagCollection::submap_type::iterator it2 = elem_by_tag.items.begin();
5154 it2 != elem_by_tag.items.end(); ++it2) {
5155 mpco::element::ElementWithSameIntRuleCollection &elem_by_rule = it2->second;
5156 /*
5157 loop over all element group-by-custom(or default) integration rule
5158 */
5159 for (mpco::element::ElementWithSameIntRuleCollection::submap_type::iterator it3 = elem_by_rule.items.begin();
5160 it3 != elem_by_rule.items.end(); ++it3) {
5161 mpco::element::ElementWithSameCustomIntRuleCollection &elem_by_custom_rule = it3->second;
5162 /*
5163 create a dataset with all elements in this group
5164 */
5165 if (elem_by_custom_rule.items.size() > 0) {
5166 /*
5167 create a name for this dataset using the following format <class_tag>-<class_name>[<integration_rule>:<custom_rule_index>]
5168 */
5169 std::stringstream ss_dset_name;
5170 ss_dset_name << elem_by_tag.class_tag << "-" << elem_by_tag.class_name
5171 << "[" << elem_by_rule.int_rule_type << ":"
5172 << elem_by_custom_rule.custom_int_rule_index << "]";
5173 elem_by_custom_rule.name = ss_dset_name.str();
5174 /*
5175 create the dataset and write data to it.
5176 the first column is the element id, the remaining columns are nodal connectivity
5177 */
5178 std::vector<int> buffer(elem_by_custom_rule.items.size()*(1 + elem_by_tag.num_nodes));
5179 size_t offset = 0;
5180 for (mpco::element::ElementWithSameCustomIntRuleCollection::collection_type::iterator it4 = elem_by_custom_rule.items.begin();

Callers

nothing calls this directly

Calls 12

createAndWriteFunction · 0.85
closeFunction · 0.85
mapElementsMethod · 0.80
stopMethod · 0.80
createFunction · 0.70
writeFunction · 0.70
startMethod · 0.45
strMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
getTagMethod · 0.45

Tested by

no test coverage detected