28 return "Plugin(Skin) extracts the boundary (skin) of the current "
29 "mesh (if `FromMesh' = 1), or from the the view `View' (in which "
30 "case it creates a new view). If `View' < 0 and `FromMesh' = 0, "
31 "the plugin is run on the current view.\n"
32 "If `Visible' is set, the plugin only extracts the skin of visible "
49 std::vector<double>
x,
y,
z;
50 std::vector<double>
v;
56 for(
int i = 0; i < N; i++) {
68 std::vector<double> *vec =
nullptr;
140 for(std::size_t i = 0; i <
x.size(); i++) vec->push_back(
x[i]);
141 for(std::size_t i = 0; i <
y.size(); i++) vec->push_back(
y[i]);
142 for(std::size_t i = 0; i <
z.size(); i++) vec->push_back(
z[i]);
143 for(std::size_t i = 0; i <
v.size(); i++) vec->push_back(
v[i]);
167 static const int tri[6][4] = {{0, 1, -1, -1}, {1, 2, -1, -1}, {2, 0, -1, -1}};
168 static const int qua[6][4] = {
169 {0, 1, -1, -1}, {1, 2, -1, -1}, {2, 3, -1, -1}, {3, 0, -1, -1}};
170 static const int tet[6][4] = {
171 {0, 1, 3, -1}, {0, 2, 1, -1}, {0, 3, 2, -1}, {1, 2, 3, -1}};
172 static const int hex[6][4] = {{0, 1, 5, 4}, {0, 3, 2, 1}, {0, 4, 7, 3},
173 {1, 2, 6, 5}, {2, 3, 7, 6}, {4, 5, 6, 7}};
174 static const int pri[6][4] = {
175 {0, 1, 4, 3}, {0, 3, 5, 2}, {1, 2, 5, 4}, {0, 2, 1, -1}, {3, 4, 5, -1}};
176 static const int pyr[6][4] = {
177 {0, 3, 2, 1}, {0, 1, 4, -1}, {0, 4, 3, -1}, {1, 2, 4, -1}, {2, 3, 4, -1}};
179 case TYPE_TRI: *boundary = &tri;
return 3;
180 case TYPE_QUA: *boundary = &qua;
return 4;
181 case TYPE_TET: *boundary = &tet;
return 4;
182 case TYPE_HEX: *boundary = &hex;
return 6;
183 case TYPE_PRI: *boundary = &pri;
return 5;
184 case TYPE_PYR: *boundary = &pyr;
return 5;
192 std::vector<GEntity *> entities;
194 std::set<MFace, MFaceLessThan> bndFaces;
195 std::set<MEdge, MEdgeLessThan> bndEdges;
196 for(std::size_t i = 0; i < entities.size(); i++) {
198 if(ge->
dim() != dim)
continue;
205 if(bndEdges.find(
f) == bndEdges.end())
214 if(bndFaces.find(
f) == bndFaces.end())
227 for(
auto it = bndEdges.begin(); it != bndEdges.end(); it++) {
228 e->
lines.push_back(
new MLine(it->getVertex(0), it->getVertex(1)));
234 for(
auto it = bndFaces.begin(); it != bndFaces.end(); it++) {
235 if(it->getNumVertices() == 3)
236 f->triangles.push_back(
237 new MTriangle(it->getVertex(0), it->getVertex(1), it->getVertex(2)));
238 else if(it->getNumVertices() == 4)
239 f->quadrangles.push_back(
240 new MQuadrangle(it->getVertex(0), it->getVertex(1), it->getVertex(2),
264 Msg::Error(
"Skin plugin cannot be applied to multi-mesh views");
273 std::set<ElmData, ElmDataLessThan> skin;
277 for(
int ent = 0; ent < data1->
getNumEntities(firstNonEmptyStep); ent++) {
278 if(visible && data1->
skipEntity(firstNonEmptyStep, ent))
continue;
279 for(
int ele = 0; ele < data1->
getNumElements(firstNonEmptyStep, ent);
281 if(data1->
skipElement(firstNonEmptyStep, ent, ele, visible))
continue;
283 int type = data1->
getType(firstNonEmptyStep, ent, ele);
284 const int(*boundary)[6][4];
286 if(!numBoundary)
continue;
287 for(
int i = 0; i < numBoundary; i++) {
289 for(
int j = 0; j < 4; j++) {
290 int nod = (*boundary)[i][j];
291 if(nod < 0)
continue;
293 data1->
getNode(firstNonEmptyStep, ent, ele, nod, x, y,
z);
298 auto it = skin.find(e);
299 if(it == skin.end()) {
302 for(
int j = 0; j < 4; j++) {
303 int nod = (*boundary)[i][j];
304 if(nod < 0)
continue;
306 for(
int comp = 0; comp < numComp; comp++) {
307 data1->
getValue(step, ent, ele, nod, comp, v);
321 for(
auto it = skin.begin(); it != skin.end(); it++) it->addInView(data2);