X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FDriverCGNS%2FDriverCGNS_Write.cxx;h=6cbeae2fe9124f9b80e3b7c3aae677755c4783cf;hb=f79e964b7592c63818f892516f3b4936d7704397;hp=657cb529e51a1bf349fb613e9aadffce27ead84d;hpb=223c5b7f5d446e18785843d69964a4df5da7a9c5;p=modules%2Fsmesh.git diff --git a/src/DriverCGNS/DriverCGNS_Write.cxx b/src/DriverCGNS/DriverCGNS_Write.cxx index 657cb529e..6cbeae2fe 100644 --- a/src/DriverCGNS/DriverCGNS_Write.cxx +++ b/src/DriverCGNS/DriverCGNS_Write.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2020 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 @@ -130,6 +130,11 @@ namespace interlaces[SMDSEntity_Quad_Penta] = ids; cgTypes [SMDSEntity_Quad_Penta] = CGNS_ENUMV( PENTA_15 ); } + { + static int ids[] = { 0,2,1,3,5,4,8,7,6,9,11,10,14,13,12,15,16,17 }; // TODO: check CGNS ORDER + interlaces[SMDSEntity_BiQuad_Penta] = ids; + cgTypes [SMDSEntity_BiQuad_Penta] = CGNS_ENUMV( PENTA_18 ); + } { static int ids[] = { 0,3,2,1,4,7,6,5 }; interlaces[SMDSEntity_Hexa] = ids; @@ -296,26 +301,26 @@ Driver_Mesh::Status DriverCGNS_Write::Perform() vector< double > coords( myMesh->NbNodes() ); int iC; // X - SMDS_NodeIteratorPtr nIt = myMesh->nodesIterator( /*idInceasingOrder=*/true ); + SMDS_NodeIteratorPtr nIt = myMesh->nodesIterator(); for ( int i = 0; nIt->more(); ++i ) coords[i] = nIt->next()->X(); if ( cg_coord_write( _fn, iBase, iZone, CGNS_ENUMV(RealDouble), "CoordinateX", &coords[0], &iC) != CG_OK ) return addMessage( cg_get_error(), /*fatal = */true ); // Y - nIt = myMesh->nodesIterator( /*idInceasingOrder=*/true ); + nIt = myMesh->nodesIterator(); for ( int i = 0; nIt->more(); ++i ) coords[i] = nIt->next()->Y(); if ( cg_coord_write( _fn, iBase, iZone, CGNS_ENUMV(RealDouble), "CoordinateY", &coords[0], &iC) != CG_OK ) return addMessage( cg_get_error(), /*fatal = */true ); // Z - nIt = myMesh->nodesIterator( /*idInceasingOrder=*/true ); + nIt = myMesh->nodesIterator(); for ( int i = 0; nIt->more(); ++i ) coords[i] = nIt->next()->Z(); if ( cg_coord_write( _fn, iBase, iZone, CGNS_ENUMV(RealDouble), "CoordinateZ", &coords[0], &iC) != CG_OK ) return addMessage( cg_get_error(), /*fatal = */true ); // store CGNS ids of nodes - nIt = myMesh->nodesIterator( /*idInceasingOrder=*/true ); + nIt = myMesh->nodesIterator(); for ( int i = 0; nIt->more(); ++i ) { const SMDS_MeshElement* n = nIt->next(); @@ -559,38 +564,53 @@ Driver_Mesh::Status DriverCGNS_Write::Perform() CGNS_ENUMT( GridLocation_t ) location = CGNS_ENUMV( Vertex ); if ( group->GetType() != SMDSAbs_Node ) { -#if CGNS_VERSION > 3130 - location = CGNS_ENUMV( CellCenter ); -#else switch ( meshDim ) { case 3: switch ( group->GetType() ) { - case SMDSAbs_Volume: location = CGNS_ENUMV( FaceCenter ); break; // !!! - case SMDSAbs_Face: location = CGNS_ENUMV( FaceCenter ); break; // OK - case SMDSAbs_Edge: location = CGNS_ENUMV( EdgeCenter ); break; // OK +#if CGNS_VERSION > 3130 + case SMDSAbs_Volume: location = CGNS_ENUMV( CellCenter ); break; +#else + case SMDSAbs_Volume: location = CGNS_ENUMV( FaceCenter ); break; +#endif + case SMDSAbs_Face: location = CGNS_ENUMV( FaceCenter ); break; + case SMDSAbs_Edge: location = CGNS_ENUMV( EdgeCenter ); break; default:; } break; case 2: switch ( group->GetType() ) { - case SMDSAbs_Face: location = CGNS_ENUMV( FaceCenter ); break; // ??? - case SMDSAbs_Edge: location = CGNS_ENUMV( EdgeCenter ); break; // OK +#if CGNS_VERSION > 3130 + case SMDSAbs_Face: location = CGNS_ENUMV( CellCenter ); break; +#else + case SMDSAbs_Face: location = CGNS_ENUMV( FaceCenter ); break; +#endif + case SMDSAbs_Edge: location = CGNS_ENUMV( EdgeCenter ); break; default:; } break; case 1: - location = CGNS_ENUMV( EdgeCenter ); break; // ??? +#if CGNS_VERSION > 3130 + location = CGNS_ENUMV( CellCenter ); break; +#else + location = CGNS_ENUMV( EdgeCenter ); break; +#endif break; } -#endif } // try to extract type of boundary condition from the group name string name = group->GetStoreName(); CGNS_ENUMT( BCType_t ) bcType = getBCType( name ); - while ( !groupNames.insert( name ).second ) - name = (SMESH_Comment( "Group_") << groupNames.size()); - + if ( !groupNames.insert( name ).second ) // assure name uniqueness + { + int index = 1; + string newName; + do { + newName = SMESH_Comment( name ) << "_" << index++; + } + while ( !groupNames.insert( newName ).second ); + name = newName; + } // write IDs of elements vector< cgsize_t > pnts; pnts.reserve( group->Extent() ); @@ -608,7 +628,7 @@ Driver_Mesh::Status DriverCGNS_Write::Perform() return addMessage( cg_get_error(), /*fatal = */true); // write BC location - if ( location != CGNS_ENUMV( Vertex )) + if ( location != CGNS_ENUMV( Vertex ) || meshDim == 1 ) { if ( cg_boco_gridlocation_write( _fn, iBase, iZone, iBC, location) != CG_OK ) return addMessage( cg_get_error(), /*fatal = */false);