+
+
+ static std::vector< VTKCellType > theVtkTypes; //!< VTK types by SMDS ones
+
+ void initVtkTypes()
+ {
+ theVtkTypes.resize( SMDSEntity_Last+1, VTK_EMPTY_CELL );
+ theVtkTypes[ SMDSEntity_Node ] = VTK_VERTEX;
+ theVtkTypes[ SMDSEntity_0D ] = VTK_VERTEX;
+ theVtkTypes[ SMDSEntity_Edge ] = VTK_LINE;
+ theVtkTypes[ SMDSEntity_Quad_Edge ] = VTK_QUADRATIC_EDGE;
+ theVtkTypes[ SMDSEntity_Triangle ] = VTK_TRIANGLE;
+ theVtkTypes[ SMDSEntity_Quad_Triangle ] = VTK_QUADRATIC_TRIANGLE;
+ theVtkTypes[ SMDSEntity_BiQuad_Triangle ] = VTK_BIQUADRATIC_TRIANGLE;
+ theVtkTypes[ SMDSEntity_Quadrangle ] = VTK_QUAD;
+ theVtkTypes[ SMDSEntity_Quad_Quadrangle ] = VTK_QUADRATIC_QUAD;
+ theVtkTypes[ SMDSEntity_BiQuad_Quadrangle ] = VTK_BIQUADRATIC_QUAD;
+ theVtkTypes[ SMDSEntity_Polygon ] = VTK_POLYGON;
+ theVtkTypes[ SMDSEntity_Quad_Polygon ] = VTK_QUADRATIC_POLYGON;
+ theVtkTypes[ SMDSEntity_Tetra ] = VTK_TETRA;
+ theVtkTypes[ SMDSEntity_Quad_Tetra ] = VTK_QUADRATIC_TETRA;
+ theVtkTypes[ SMDSEntity_Pyramid ] = VTK_PYRAMID;
+ theVtkTypes[ SMDSEntity_Quad_Pyramid ] = VTK_QUADRATIC_PYRAMID;
+ theVtkTypes[ SMDSEntity_Hexa ] = VTK_HEXAHEDRON;
+ theVtkTypes[ SMDSEntity_Quad_Hexa ] = VTK_QUADRATIC_HEXAHEDRON;
+ theVtkTypes[ SMDSEntity_TriQuad_Hexa ] = VTK_TRIQUADRATIC_HEXAHEDRON;
+ theVtkTypes[ SMDSEntity_Penta ] = VTK_WEDGE;
+ theVtkTypes[ SMDSEntity_Quad_Penta ] = VTK_QUADRATIC_WEDGE;
+ theVtkTypes[ SMDSEntity_BiQuad_Penta ] = VTK_BIQUADRATIC_QUADRATIC_WEDGE;
+ theVtkTypes[ SMDSEntity_Hexagonal_Prism ] = VTK_HEXAGONAL_PRISM;
+ theVtkTypes[ SMDSEntity_Polyhedra ] = VTK_POLYHEDRON;
+ //theVtkTypes[ SMDSEntity_Quad_Polyhedra ] = ;
+ theVtkTypes[ SMDSEntity_Ball ] = VTK_POLY_VERTEX;
+ }
+
+
+ //! indices to transform cell connectivity from SMDS to VTK
+ static std::vector< std::vector< int > > theToVtkInterlaces;
+
+ void initToVtkInterlaces()
+ {
+ theToVtkInterlaces.resize( SMDSEntity_Last+1 );
+ // {
+ // const int ids[] = {0};
+ // theToVtkInterlaces[SMDSEntity_0D].assign( &ids[0], &ids[0]+1 );
+ // theToVtkInterlaces[SMDSEntity_Node].assign( &ids[0], &ids[0]+1 );
+ // }
+ // {
+ // const int ids[] = {0,1};
+ // theToVtkInterlaces[SMDSEntity_Edge].assign( &ids[0], &ids[0]+2 );
+ // }
+ // {
+ // const int ids[] = {0,1,2};
+ // theToVtkInterlaces[SMDSEntity_Quad_Edge].assign( &ids[0], &ids[0]+3 );
+ // }
+ // {
+ // const int ids[] = {0,1,2};
+ // theToVtkInterlaces[SMDSEntity_Triangle].assign( &ids[0], &ids[0]+3 );
+ // }
+ // {
+ // const int ids[] = {0,1,2,3,4,5};
+ // theToVtkInterlaces[SMDSEntity_Quad_Triangle].assign( &ids[0], &ids[0]+6 );
+ // }
+ // {
+ // const int ids[] = {0,1,2,3};
+ // theToVtkInterlaces[SMDSEntity_Quadrangle].assign( &ids[0], &ids[0]+4 );
+ // }
+ // {
+ // const int ids[] = {0,1,2,3,4,5,6,7};
+ // theToVtkInterlaces[SMDSEntity_Quad_Quadrangle].assign( &ids[0], &ids[0]+8 );
+ // }
+ // {
+ // const int ids[] = {0,1,2,3,4,5,6,7,8};
+ // theToVtkInterlaces[SMDSEntity_BiQuad_Quadrangle].assign( &ids[0], &ids[0]+9 );
+ // }
+ {
+ const int ids[] = {0,2,1,3};
+ theToVtkInterlaces[SMDSEntity_Tetra].assign( &ids[0], &ids[0]+4 );
+ }
+ {
+ const int ids[] = {0,2,1,3,6,5,4,7,9,8};
+ theToVtkInterlaces[SMDSEntity_Quad_Tetra].assign( &ids[0], &ids[0]+10 );
+ }
+ {
+ const int ids[] = {0,3,2,1,4};
+ theToVtkInterlaces[SMDSEntity_Pyramid].assign( &ids[0], &ids[0]+5 );
+ }
+ {
+ const int ids[] = {0,3,2,1,4,8,7,6,5,9,12,11,10};
+ theToVtkInterlaces[SMDSEntity_Quad_Pyramid].assign( &ids[0], &ids[0]+13 );
+ }
+ {
+ const int ids[] = {0,3,2,1,4,7,6,5};
+ theToVtkInterlaces[SMDSEntity_Hexa].assign( &ids[0], &ids[0]+8 );
+ }
+ {
+ const int ids[] = {0,3,2,1,4,7,6,5,11,10,9,8,15,14,13,12,16,19,18,17};
+ theToVtkInterlaces[SMDSEntity_Quad_Hexa].assign( &ids[0], &ids[0]+20 );
+ }
+ {
+ const int ids[] = {0,3,2,1,4,7,6,5,11,10,9,8,15,14,13,12,16,19,18,17, 21,23,24,22,20,25,26};
+ theToVtkInterlaces[SMDSEntity_TriQuad_Hexa].assign( &ids[0], &ids[0]+27 );
+ }
+ {
+ const int ids[] = {0,1,2,3,4,5};
+ theToVtkInterlaces[SMDSEntity_Penta].assign( &ids[0], &ids[0]+6 );
+ }
+ {
+ const int ids[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14}; // TODO: check
+ theToVtkInterlaces[SMDSEntity_Quad_Penta].assign( &ids[0], &ids[0]+15 );
+ }
+ {
+ const int ids[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};// TODO: check
+ theToVtkInterlaces[SMDSEntity_BiQuad_Penta].assign( &ids[0], &ids[0]+18 );
+ }
+ {
+ const int ids[] = {0,5,4,3,2,1,6,11,10,9,8,7};
+ theToVtkInterlaces[SMDSEntity_Hexagonal_Prism].assign( &ids[0], &ids[0]+12 );
+ }
+ }
+
+
+ //! indices to reverse an SMDS cell
+ static std::vector< std::vector< int > > theReverseInterlaces;
+
+ void initReverseInterlaces()
+ {
+ theReverseInterlaces.resize( SMDSEntity_Last+1 );
+ {
+ const int ids[] = {0};
+ theReverseInterlaces[SMDSEntity_0D ].assign( &ids[0], &ids[0]+1 );
+ theReverseInterlaces[SMDSEntity_Node].assign( &ids[0], &ids[0]+1 );
+ theReverseInterlaces[SMDSEntity_Ball].assign( &ids[0], &ids[0]+1 );
+ }
+ {
+ const int ids[] = {1,0};
+ theReverseInterlaces[SMDSEntity_Edge].assign( &ids[0], &ids[0]+2 );
+ }
+ {
+ const int ids[] = {1,0,2};
+ theReverseInterlaces[SMDSEntity_Quad_Edge].assign( &ids[0], &ids[0]+3 );
+ }
+ {
+ const int ids[] = {0,2,1};
+ theReverseInterlaces[SMDSEntity_Triangle].assign( &ids[0], &ids[0]+3 );
+ }
+ {
+ const int ids[] = {0,2,1,5,4,3};
+ theReverseInterlaces[SMDSEntity_Quad_Triangle].assign( &ids[0], &ids[0]+6 );
+ }
+ {
+ const int ids[] = {0,2,1,5,4,3,6};
+ theReverseInterlaces[SMDSEntity_BiQuad_Triangle].assign( &ids[0], &ids[0]+7 );
+ }
+ {
+ const int ids[] = {0,3,2,1};
+ theReverseInterlaces[SMDSEntity_Quadrangle].assign( &ids[0], &ids[0]+4 );
+ }
+ {
+ const int ids[] = {0,3,2,1,7,6,5,4};
+ theReverseInterlaces[SMDSEntity_Quad_Quadrangle].assign( &ids[0], &ids[0]+8 );
+ }
+ {
+ const int ids[] = {0,3,2,1,7,6,5,4,8};
+ theReverseInterlaces[SMDSEntity_BiQuad_Quadrangle].assign( &ids[0], &ids[0]+9 );
+ }
+ {
+ const int ids[] = {0,2,1,3};
+ theReverseInterlaces[SMDSEntity_Tetra].assign( &ids[0], &ids[0]+4 );
+ }
+ {
+ const int ids[] = {0,2,1,3,6,5,4,7,9,8};
+ theReverseInterlaces[SMDSEntity_Quad_Tetra].assign( &ids[0], &ids[0]+10 );
+ }
+ {
+ const int ids[] = {0,3,2,1,4};
+ theReverseInterlaces[SMDSEntity_Pyramid].assign( &ids[0], &ids[0]+5 );
+ }
+ {
+ const int ids[] = {0,3,2,1,4,8,7,6,5,9,12,11,10};
+ theReverseInterlaces[SMDSEntity_Quad_Pyramid].assign( &ids[0], &ids[0]+13 );
+ }
+ {
+ const int ids[] = {0,3,2,1,4,7,6,5};
+ theReverseInterlaces[SMDSEntity_Hexa].assign( &ids[0], &ids[0]+8 );
+ }
+ {
+ const int ids[] = {0,3,2,1,4,7,6,5,11,10,9,8,15,14,13,12,16,19,18,17};
+ theReverseInterlaces[SMDSEntity_Quad_Hexa].assign( &ids[0], &ids[0]+20 );
+ }
+ {
+ const int ids[] = {0,3,2,1,4,7,6,5,11,10,9,8,15,14,13,12,16,19,18,17, 20,24,23,22,21,25,26};
+ theReverseInterlaces[SMDSEntity_TriQuad_Hexa].assign( &ids[0], &ids[0]+27 );
+ }
+ {
+ const int ids[] = {0,2,1,3,5,4};
+ theReverseInterlaces[SMDSEntity_Penta].assign( &ids[0], &ids[0]+6 );
+ }
+ {
+ const int ids[] = {0,2,1,3,5,4, 8,7,6,11,10,9,12,14,13};
+ theReverseInterlaces[SMDSEntity_Quad_Penta].assign( &ids[0], &ids[0]+15 );
+ }
+ {
+ const int ids[] = {0,2,1,3,5,4, 8,7,6,11,10,9,12,14,13,15,16,17};
+ theReverseInterlaces[SMDSEntity_BiQuad_Penta].assign( &ids[0], &ids[0]+18 );
+ }
+ {
+ const int ids[] = {0,5,4,3,2,1,6,11,10,9,8,7};
+ theReverseInterlaces[SMDSEntity_Hexagonal_Prism].assign( &ids[0], &ids[0]+12 );
+ }
+ }
+
+
+ //! indices to set nodes of a quadratic 1D or 2D element in interlaced order
+ static std::vector< std::vector< int > > theQuadInterlace;
+
+ void initQuadInterlace()
+ {
+ theQuadInterlace.resize( SMDSEntity_Last+1 );
+ {
+ const int ids[] = {0,2,1};
+ theQuadInterlace[SMDSEntity_Quad_Edge].assign( &ids[0], &ids[0]+3 );
+ }
+ {
+ const int ids[] = {0,3,1,4,2,5,6};
+ theQuadInterlace[SMDSEntity_Quad_Triangle ].assign( &ids[0], &ids[0]+6 );
+ theQuadInterlace[SMDSEntity_BiQuad_Triangle].assign( &ids[0], &ids[0]+7 );
+ }
+ {
+ const int ids[] = {0,4,1,5,2,6,3,7,8};
+ theQuadInterlace[SMDSEntity_Quad_Quadrangle ].assign( &ids[0], &ids[0]+8 );
+ theQuadInterlace[SMDSEntity_BiQuad_Quadrangle].assign( &ids[0], &ids[0]+9 );
+ }
+ }
+
+
+ //! indices to transform cell connectivity from VTK to SMDS
+ static std::vector< std::vector<int> > theFromVtkInterlaces;
+
+ void initFromVtkInterlaces()
+ {
+ theFromVtkInterlaces.resize( SMDSEntity_Last+1 );
+ for ( int iSMDS = 0; iSMDS < SMDSEntity_Last; ++iSMDS )
+ {
+ const std::vector<int> & toVtk = SMDS_MeshCell::toVtkOrder( SMDSAbs_EntityType( iSMDS ));
+ std::vector<int> & toSmds = theFromVtkInterlaces[ iSMDS ];
+ toSmds.resize( toVtk.size() );
+ for ( size_t i = 0; i < toVtk.size(); ++i )
+ toSmds[ toVtk[i] ] = i;
+ }
+ }
+