52 "Process elements to extract a specified surface(s) or composites(s).");
57 "Tag identifying surface/composite to process.");
67 string surf =
m_config[
"surf"].as<
string>();
70 vector<unsigned int> surfs;
72 sort(surfs.begin(), surfs.end());
77 cout <<
"ProcessExtractSurf: extracting surface"
78 << (surfs.size() > 1 ?
"s" :
"") <<
" " << surf << endl;
82 vector<ElementSharedPtr> el =
m_mesh->m_element[
m_mesh->m_expDim-1];
89 m_mesh->m_vertexSet.clear();
94 for (i = 0; i < el.size(); ++i)
96 vector<EdgeSharedPtr> edges = el[i]->GetEdgeList();
97 for (j = 0; j < edges.size(); ++j)
99 edges[j]->m_elLink.clear();
105 for (j = 0; j < f->m_edgeList.size(); ++j)
107 f->m_edgeList[j]->m_elLink.clear();
113 boost::unordered_set<int> keptIds;
116 for (i = 0; i < el.size(); ++i)
119 vector<int> inter, tags = el[i]->GetTagList();
121 sort(tags.begin(), tags.end());
122 set_intersection(surfs.begin(), surfs.end(),
123 tags .begin(), tags .end(),
124 back_inserter(inter));
127 if (inter.size() != 1)
134 vector<NodeSharedPtr> verts = elmt->GetVertexList();
135 vector<EdgeSharedPtr> edges = elmt->GetEdgeList();
138 for (j = 0; j < verts.size(); ++j)
140 m_mesh->m_vertexSet.insert(verts[j]);
151 elmt->SetId(e->m_id);
155 for (j = 0; j < edges.size(); ++j)
157 m_mesh->m_edgeSet.insert(f->m_edgeList[j]);
158 elmt->SetEdge(j, f->m_edgeList[j]);
159 f->m_edgeList[j]->m_elLink.push_back(
160 std::make_pair(elmt, j));
162 elmt->SetId(f->m_id);
166 for (j = 0; j < edges.size(); ++j)
168 m_mesh->m_edgeSet.insert(edges[j]);
175 keptIds.insert(elmt->GetId());
190 m_mesh->m_composite.clear();
195 for (it = tmp.begin(); it != tmp.end(); ++it)
197 if (it->second->m_items[0]->GetDim() !=
m_mesh->m_expDim)
202 vector<ElementSharedPtr> el = it->second->m_items;
203 it->second->m_items.clear();
205 for (i = 0; i < el.size(); ++i)
207 if (keptIds.count(el[i]->GetId()) > 0)
209 it->second->m_items.push_back(el[i]);
213 if (it->second->m_items.size() == 0)
218 m_mesh->m_composite.insert(*it);
222 maxId = std::max(maxId, (
int)it->second->m_id) + 1;
225 tmp =
m_mesh->m_composite;
226 m_mesh->m_composite.clear();
231 for (it = tmp.begin(); it != tmp.end(); ++it)
234 vector<ElementSharedPtr> el = c->m_items;
237 string initialTag = el[0]->GetTag();
238 c->m_items.resize(1);
239 c->m_tag = initialTag;
243 map<string, CompositeSharedPtr> newComps;
244 newComps[initialTag] = c;
248 for (i = 1; i < el.size(); ++i)
253 string tag = el[i]->GetTag();
254 it2 = newComps.find(tag);
255 if (it2 == newComps.end())
258 newComp->m_id = maxId++;
259 newComp->m_tag = tag;
260 newComp->m_items.push_back(el[i]);
261 newComps[tag] = newComp;
265 it2->second->m_items.push_back(el[i]);
270 if (
m_mesh->m_verbose && newComps.size() > 1)
272 cout <<
"- Mapping composite " << it->first <<
" ->";
276 for (i = 0, it2 = newComps.begin(); it2 != newComps.end();
279 if (
m_mesh->m_verbose && newComps.size() > 1)
281 cout << (i > 0 ?
", " :
" ") << it2->second->m_id <<
"("
282 << it2->second->m_tag <<
")";
284 m_mesh->m_composite[it2->second->m_id] = it2->second;
287 if (
m_mesh->m_verbose && newComps.size() > 1)