Is this skinner bug?

Issue #141 resolved
In-hak Min created an issue

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;
}

Comments (12)

  1. Vijay M

    Thanks for the test program. Looking at the code, nothing looks odd. But I’ll see if I can replicate the issue and get back to you.

  2. In-hak Min reporter

    actually i want to use penta. but i can not found penta type in moab. is same shape penta and prism? i think prism is seems penta.

  3. Iulian Grindeanu

    35 moab::EntityHandle conn_prism[1][6] = {
    36 { 12, 9,5, 10, 13, 6 }
    37 };

    with the correct one you get expected result
    ./test4
    Total hex count is 2
    Total prism count is 1
    Total skin triangle count: 2
    Total skin quad count: 11

  4. In-hak Min reporter

    is this wrong vertex connection?

    i will check after some hours.

    and get back result.

    thank you.

  5. Iulian Grindeanu

    yes, prism is triangular prism; we do not use penta as a name; pentahedron ? has indeed 5 faces

  6. In-hak Min reporter

    We called penta for “pentahedral” in LsDyna.
    And below image is supported vertex connection in inputdeck.

    So I have translate connection as below when build moab::MBPRISM.

    1, 2, 3, 4, 5, 6 → 1, 2, 5, 4, 3, 6

    Is this right?

    Thank you. 🙂

  7. Iulian Grindeanu

    yes, that would be correct, our convention is different compared to LSDYNA, but it is similar to any other convention, vtk, cubit, nastran, ansys

  8. Log in to comment