[MOAB-dev] Is this skinner bug?
In-hak Min
inhak.min at gmail.com
Wed Apr 14 00:39:29 CDT 2021
Hello all,
I am using skinner class.
I have created 3 elements, that mixed 2 hex and 1 prism. (Please refer the
attachment.)
Why the extracted skin quad count is 13? 11 is right.
Skinner is not supported mixed type?
Here is the reproduce code.
---------------------------------------
#include "moab/Core.hpp"
#include "moab/Skinner.hpp"
moab::Core *mb;
int main()
{
mb = new moab::Core();
const unsigned NUMVTX = 14; // The number of vertexes
// This double array stores the x, y, z coordinate of each vertex.
const double vertex_coords[3 * NUMVTX] = {
6776.294, 1105.722, 522.2,
6588.656, 1105.722, 471.4,
6776.303, 1056.417, 471.4,
6776.294, 1105.722, 471.4,
6588.656, 1056.417, 565.7191,
6588.656, 1105.722, 565.7429,
6588.617, 1056.417, 471.4,
6682.527, 1056.417, 471.4,
6588.611, 1056.417, 522.2,
6682.476, 1105.722, 522.2,
6682.476, 1105.722, 471.4,
6682.424, 1056.417, 522.2,
6588.656, 1105.722, 522.2,
6776.303, 1056.417, 522.2
};
moab::EntityHandle conn_hex[2][8] = {
{ 8, 11, 2, 7, 12, 10, 13, 9 },
{ 11, 8, 3, 4, 10, 12, 14, 1 }
};
moab::EntityHandle conn_prism[1][6] = {
{ 12, 5, 6, 10, 9, 13 }
};
moab::ErrorCode rval;
for(int i=0; i<NUMVTX; i++) {
float x = vertex_coords[i*3];
float y = vertex_coords[i*3+1];
float z = vertex_coords[i*3+2];
std::vector<double> coord(3);
coord[0] = x;
coord[1] = y;
coord[2] = z;
moab::EntityHandle h;
rval = mb->create_vertex( coord.data(), h );
}
moab::Range range;
for(int i=0; i<2; i++) {
moab::EntityHandle element;
rval = mb->create_element( moab::MBHEX, conn_hex[i], 8, element );
range.insert( element );
}
for(int i=0; i<1; i++) {
moab::EntityHandle element;
rval = mb->create_element( moab::MBPRISM, conn_prism[i], 6, element
);
range.insert( element );
}
mb->add_entities(0, range);
int count;
mb->get_number_entities_by_type(0, moab::MBHEX, count);
printf("Total hex count is %d\n", count);
mb->get_number_entities_by_type(0, moab::MBPRISM, count);
printf("Total prism count is %d\n", count);
moab::ErrorCode ret;
moab::Range faces;
moab::Skinner skinner(mb);
ret = skinner.find_skin(0, range, false, faces);
moab::Range tri_range;
unsigned int tri_count;
moab::Range quad_range;
unsigned int quad_count;
for( moab::Range::iterator it = faces.begin(); it != faces.end(); ++it ) {
moab::EntityType type = mb->type_from_handle(*it);
if(type == moab::MBTRI) tri_range.insert(*it);
if(type == moab::MBQUAD) quad_range.insert(*it);
}
printf("Total skin triangle count: %d\n", tri_range.size());
printf("Total skin quad count: %d\n", quad_range.size());
delete mb;
}
-------------- next part --------------
#include "moab/Core.hpp"
#include "moab/Skinner.hpp"
moab::Core *mb;
int main()
{
mb = new moab::Core();
const unsigned NUMVTX = 14; // The number of vertexes
// This double array stores the x, y, z coordinate of each vertex.
const double vertex_coords[3 * NUMVTX] = {
6776.294, 1105.722, 522.2,
6588.656, 1105.722, 471.4,
6776.303, 1056.417, 471.4,
6776.294, 1105.722, 471.4,
6588.656, 1056.417, 565.7191,
6588.656, 1105.722, 565.7429,
6588.617, 1056.417, 471.4,
6682.527, 1056.417, 471.4,
6588.611, 1056.417, 522.2,
6682.476, 1105.722, 522.2,
6682.476, 1105.722, 471.4,
6682.424, 1056.417, 522.2,
6588.656, 1105.722, 522.2,
6776.303, 1056.417, 522.2
};
moab::EntityHandle conn_hex[2][8] = {
{ 8, 11, 2, 7, 12, 10, 13, 9 },
{ 11, 8, 3, 4, 10, 12, 14, 1 }
};
moab::EntityHandle conn_prism[1][6] = {
{ 12, 5, 6, 10, 9, 13 }
};
moab::ErrorCode rval;
for(int i=0; i<NUMVTX; i++) {
float x = vertex_coords[i*3];
float y = vertex_coords[i*3+1];
float z = vertex_coords[i*3+2];
std::vector<double> coord(3);
coord[0] = x;
coord[1] = y;
coord[2] = z;
moab::EntityHandle h;
rval = mb->create_vertex( coord.data(), h );
}
moab::Range range;
for(int i=0; i<2; i++) {
moab::EntityHandle element;
rval = mb->create_element( moab::MBHEX, conn_hex[i], 8, element );
range.insert( element );
}
for(int i=0; i<1; i++) {
moab::EntityHandle element;
rval = mb->create_element( moab::MBPRISM, conn_prism[i], 6, element );
range.insert( element );
}
mb->add_entities(0, range);
int count;
mb->get_number_entities_by_type(0, moab::MBHEX, count);
printf("Total hex count is %d\n", count);
mb->get_number_entities_by_type(0, moab::MBPRISM, count);
printf("Total prism count is %d\n", count);
moab::ErrorCode ret;
moab::Range faces;
moab::Skinner skinner(mb);
ret = skinner.find_skin(0, range, false, faces);
moab::Range tri_range;
unsigned int tri_count;
moab::Range quad_range;
unsigned int quad_count;
for( moab::Range::iterator it = faces.begin(); it != faces.end(); ++it ) {
moab::EntityType type = mb->type_from_handle(*it);
if(type == moab::MBTRI) tri_range.insert(*it);
if(type == moab::MBQUAD) quad_range.insert(*it);
}
printf("Total skin triangle count: %d\n", tri_range.size());
printf("Total skin quad count: %d\n", quad_range.size());
delete mb;
}
More information about the moab-dev
mailing list