24 {
GMSH_FULLRC,
"OuputPhysicalGroup",
nullptr, 2000.},
36 return "Plugin(MeshSubEntities) creates mesh elements for the "
37 "entities of dimension `OutputDimension' (0 for vertices, "
38 "1 for edges, 2 for faces) of the `InputPhysicalGroup' of "
39 "dimension `InputDimension'. The plugin creates new elements "
40 "belonging to `OutputPhysicalGroup'.";
60 if(inputdim < 0 || inputdim > 3 || outputdim < 0 || outputdim > 3 ||
61 outputdim > inputdim) {
67 std::map<int, std::vector<GEntity *> > groups;
69 std::vector<GEntity *> entities = groups[inputphysical];
71 if(entities.empty()) {
72 Msg::Error(
"Physical group %d (dimension %d) is empty", inputphysical,
78 std::vector<MElement *> elements;
79 for(std::size_t i = 0; i < entities.size(); i++)
80 for(std::size_t j = 0; j < entities[i]->getNumMeshElements(); j++)
81 elements.push_back(entities[i]->getMeshElement(j));
84 std::set<MVertex *> vertices;
85 for(std::size_t i = 0; i < elements.size(); i++) {
86 for(std::size_t j = 0; j < elements[i]->getNumVertices(); j++) {
87 MVertex *v = elements[i]->getVertex(j);
91 for(
auto it = vertices.begin(); it != vertices.end(); ++it) {
107 else if(outputdim == 1) {
108 std::set<MEdge, MEdgeLessThan>
edges;
109 for(std::size_t i = 0; i < elements.size(); i++) {
110 for(
int j = 0; j < elements[i]->getNumEdges(); j++) {
111 MEdge e = elements[i]->getEdge(j);
115 for(
auto it =
edges.begin(); it !=
edges.end(); ++it) {
116 const MEdge &e = *it;
119 if(v0->
onWhat() && v1->onWhat()) {
121 ((v1->onWhat()->dim() == 1 && v0->
onWhat() == v1->onWhat()) ||
122 v1->onWhat()->dim() == 0))
124 else if(v1->onWhat()->dim() == 1 &&
127 ge = (
GEdge *)v1->onWhat();
141 Msg::Error(
"Plugin(MeshSubEntities) not coded yet for output dim %d",