X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FDriverCGNS%2FDriverCGNS_Write.cxx;h=9ad3e2bc3363c99343578ba41fb94310830856e4;hp=edc474163b16f1616b63caf4a6502ab4990054e6;hb=7eda9ca931ed2a11cb5e4637e4ffe19f5c061115;hpb=f5016d85b7b4b88623723027a1585c6414c4dc66 diff --git a/src/DriverCGNS/DriverCGNS_Write.cxx b/src/DriverCGNS/DriverCGNS_Write.cxx index edc474163..9ad3e2bc3 100644 --- a/src/DriverCGNS/DriverCGNS_Write.cxx +++ b/src/DriverCGNS/DriverCGNS_Write.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -81,6 +81,8 @@ namespace static int ids[] = { 0, 2, 1, 5, 4, 3 }; interlaces[SMDSEntity_Quad_Triangle] = ids; cgTypes [SMDSEntity_Quad_Triangle] = CGNS_ENUMV( TRI_6 ); + interlaces[SMDSEntity_BiQuad_Triangle] = ids; + cgTypes [SMDSEntity_BiQuad_Triangle] = CGNS_ENUMV( TRI_6 ); } { static int ids[] = { 0, 3, 2, 1 }; @@ -145,6 +147,7 @@ namespace } { cgTypes[SMDSEntity_Polygon] = CGNS_ENUMV( NGON_n ); + cgTypes[SMDSEntity_Quad_Polygon] = CGNS_ENUMV( NGON_n ); cgTypes[SMDSEntity_Polyhedra] = CGNS_ENUMV( NFACE_n ); cgTypes[SMDSEntity_Hexagonal_Prism] = CGNS_ENUMV( NFACE_n ); } @@ -341,9 +344,12 @@ Driver_Mesh::Status DriverCGNS_Write::Perform() startID = cgID; if ( interlace ) // STANDARD elements + { + int cgnsNbNodes; // get nb nodes by element type, that can be less that elem->NbNodes() + cg_npe( cgType, &cgnsNbNodes ); do { - for ( int i = 0, nb = elem->NbNodes(); i < nb; ++i ) + for ( int i = 0; i < cgnsNbNodes; ++i ) elemData.push_back( cgnsID( elem->GetNode( interlace[i] ), n2cgID )); if ( elem->GetID() != cgID ) elem2cgID.insert( elem2cgID.end(), make_pair( elem, cgID )); @@ -351,7 +357,7 @@ Driver_Mesh::Status DriverCGNS_Write::Perform() elem = elemIt->more() ? elemIt->next() : 0; } while ( elem && elem->GetEntityType() == elemType ); - + } else if ( elemType == SMDSEntity_Polygon ) // POLYGONS do { @@ -365,6 +371,21 @@ Driver_Mesh::Status DriverCGNS_Write::Perform() } while ( elem && elem->GetEntityType() == elemType ); + else if ( elemType == SMDSEntity_Quad_Polygon ) // QUADRATIC POLYGONS + do // write as linear NGON_n + { + elemData.push_back( elem->NbNodes() ); + interlace = & SMDS_MeshCell::interlacedSmdsOrder( SMDSEntity_Quad_Polygon, + elem->NbNodes() )[0]; + for ( int i = 0, nb = elem->NbNodes(); i < nb; ++i ) + elemData.push_back( cgnsID( elem->GetNode( interlace[i] ), n2cgID )); + if ( elem->GetID() != cgID ) + elem2cgID.insert( elem2cgID.end(), make_pair( elem, cgID )); + ++cgID; + elem = elemIt->more() ? elemIt->next() : 0; + } + while ( elem && elem->GetEntityType() == elemType ); + else if ( elemType == SMDSEntity_Polyhedra || elemType == SMDSEntity_Hexagonal_Prism) // POLYHEDRA {