1 // Copyright (C) 2021-2023 CEA, EDF
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "MeshFormatWriter.hxx"
21 #include "MEDFileMesh.hxx"
22 #include "MEDFileField.hxx"
23 #include "MEDFileData.hxx"
24 #include "MEDCouplingFieldDouble.hxx"
25 #include "libmesh5.hxx"
26 #include "MEDMESHConverterUtilities.hxx"
34 namespace MEDCoupling {
36 MeshFormatWriter::MeshFormatWriter()
38 MeshFormatWriter::MeshFormatWriter(const std::string& meshFileName,
39 const std::vector<std::string>& fieldFileNames):_meshFileName(meshFileName),
40 _fieldFileNames(fieldFileNames)
42 MeshFormatWriter::~MeshFormatWriter()
44 void MeshFormatWriter::setMeshFileName(const std::string& meshFileName)
46 _meshFileName = meshFileName;
48 void MeshFormatWriter::setFieldFileNames(const std::vector<std::string>& fieldFileNames)
50 _fieldFileNames = fieldFileNames;
52 void MeshFormatWriter::setMEDFileDS(MEDCoupling::MEDFileData* mfd)
57 addMessage( MeshFormat::Comment(" MEDFileData is nullptr! ") << _meshFileName, /*fatal=*/true );
60 if ( !mfd->getNumberOfMeshes())
62 addMessage( MeshFormat::Comment("No Mesh in MEDFileData! ") << _meshFileName, /*fatal=*/true );
65 if ( mfd->getNumberOfMeshes() > 1)
67 addMessage( MeshFormat::Comment("More than One Mesh in File! ") << _meshFileName, /*fatal=*/true );
71 MEDCoupling::MEDFileMeshes* meshes = mfd->getMeshes();
72 _mesh = meshes->getMeshAtPos(0);
75 MEDCoupling::MEDFileFields* fields = mfd->getFields();
77 for (int i = 0; i<fields->getNumberOfFields(); i++ )
79 MEDCoupling::MEDFileAnyTypeFieldMultiTS* field = fields->getFieldAtPos(i);
80 MEDCoupling::MEDFileFieldMultiTS * f = dynamic_cast<MEDCoupling::MEDFileFieldMultiTS *>(field);
87 void MeshFormatWriter::write()
90 MeshFormat::Localizer loc;
92 MEDCoupling::MCAuto<MEDCoupling::MEDCouplingMesh > mesh = _mesh->getMeshAtLevel( 1 );
93 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh = mesh->buildUnstructured();
94 _dim = umesh->getSpaceDimension();
96 if (_dim != 2 && _dim != 3)
98 addMessage( MeshFormat::Comment("Only 3D or 2D mesh allowed! ") << _meshFileName, /*fatal=*/true );
103 _version = sizeof(double) < 8 ? 1 : 2;
104 _writer = MeshFormat::MeshFormatParser();
105 _myCurrentOpenFile = _meshFileName;
106 _myCurrentFileId = _writer.GmfOpenMesh( _meshFileName.c_str(), GmfWrite, _version, _dim );
107 if ( !_myCurrentFileId )
109 if ( MeshFormat::isMeshExtensionCorrect( _meshFileName ))
111 addMessage( MeshFormat::Comment("Can't open for writing ") << _meshFileName, /*fatal=*/true );
117 addMessage( MeshFormat::Comment("Not '.mesh' or '.meshb' extension of file ") << _meshFileName, /*fatal=*/true );
125 _writer.GmfCloseMesh(_myCurrentFileId);
126 _myCurrentFileId = -1;
127 _myCurrentOpenFile = "";
128 if (_fields.size()) performFields();
133 MeshFormat::Status MeshFormatWriter::perform()
137 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingMesh > mesh1;
138 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh1;
139 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingMesh > mesh2;
140 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2;
141 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingMesh > mesh3;
142 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3;
144 std::vector<int> dims = _mesh->getNonEmptyLevelsExt();
145 int dim = _mesh->getMeshDimension();
146 bool threeDElements = false;
147 bool twoDElements = false;
148 bool OneDElements = false;
149 if (dims.size() != 0)
151 bool maxLevelDimElments = ( std::find(dims.begin(), dims.end(), 0) != dims.end() );
152 bool nextToMaxLevelDimElments = ( std::find(dims.begin(), dims.end(), -1) != dims.end() );
153 bool nextToNextToMaxLevelDimElments = (std::find(dims.begin(), dims.end(), -2) != dims.end() );
154 threeDElements = (dim == 3) ? maxLevelDimElments : false ;
155 twoDElements = (dim == 3) ? nextToMaxLevelDimElments : maxLevelDimElments ;
156 OneDElements = (dim == 3) ? nextToNextToMaxLevelDimElments : nextToMaxLevelDimElments;
159 MEDCoupling::mcIdType nbEdgesNSEG2 = 0;
160 MEDCoupling::mcIdType nbEdgesNSEG3 = 0;
161 MEDCoupling::mcIdType nbTRI3 = 0;
162 MEDCoupling::mcIdType nbTRI6 = 0;
163 MEDCoupling::mcIdType nbQUAD4 = 0;
164 MEDCoupling::mcIdType nbQUAD8 = 0;
165 MEDCoupling::mcIdType nbQUAD9 = 0;
166 MEDCoupling::mcIdType nbTETRA4 = 0;
167 MEDCoupling::mcIdType nbTETRA10 = 0;
168 MEDCoupling::mcIdType nbPYRA5 = 0;
169 MEDCoupling::mcIdType nbHEXA8 = 0;
170 MEDCoupling::mcIdType nbHEXA20 = 0;
171 MEDCoupling::mcIdType nbHEXA27 = 0;
172 MEDCoupling::mcIdType nbPENTA6 = 0;
176 mesh1 = _mesh->getMeshAtLevel( 1-dim );
177 umesh1 = mesh1->buildUnstructured();
178 nbEdgesNSEG2 = umesh1->getNumberOfCellsWithType(INTERP_KERNEL::NORM_SEG2);
180 nbEdgesNSEG3 = umesh1->getNumberOfCellsWithType(INTERP_KERNEL::NORM_SEG3);
185 mesh2 = _mesh->getMeshAtLevel( 2-dim );
186 umesh2 = mesh2->buildUnstructured();
187 nbTRI3 = umesh2->getNumberOfCellsWithType(INTERP_KERNEL::NORM_TRI3);
189 nbTRI6 = umesh2->getNumberOfCellsWithType(INTERP_KERNEL::NORM_TRI6);
191 nbQUAD4 = umesh2->getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4);
193 nbQUAD8 = umesh2->getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD8);
195 nbQUAD9 = umesh2->getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD9);
201 mesh3 = _mesh->getMeshAtLevel( 3-dim );
202 umesh3 = mesh3->buildUnstructured();
203 nbTETRA4 = umesh3->getNumberOfCellsWithType(INTERP_KERNEL::NORM_TETRA4);
205 nbTETRA10 = umesh3->getNumberOfCellsWithType(INTERP_KERNEL::NORM_TETRA10);
207 nbPYRA5 = umesh3->getNumberOfCellsWithType(INTERP_KERNEL::NORM_PYRA5);
209 nbHEXA8 = umesh3->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8);
211 nbHEXA20 = umesh3->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA20);
213 nbHEXA27 = umesh3->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA27);
215 nbPENTA6 = umesh3->getNumberOfCellsWithType(INTERP_KERNEL::NORM_PENTA6);
221 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingMesh > mesh0 = _mesh->getMeshAtLevel(1);
222 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh0 = mesh0->buildUnstructured();
228 if ( nbEdgesNSEG2 > 0)
230 getNSEG2( nbEdgesNSEG2, umesh1);
232 //~// nodes of quadratic edges SEG3
233 if ( nbEdgesNSEG3 > 0)
235 getNSEG3( nbEdgesNSEG3, umesh1);
241 getTRI3( nbTRI3, umesh2);
244 // nodes of quadratic triangles
248 getTRI6( nbTRI6, umesh2);
251 //~// quadrangles QUAD4
254 getQUAD4(nbQUAD4, umesh2);
257 //~// quadrangles quadratic QUAD8
260 getQUAD8( nbQUAD8, umesh2);
263 //~// quadrangles quadratic QUAD9
266 getQUAD9( nbQUAD9, umesh2);
272 getTETRA4( nbTETRA4, umesh3);
277 getTETRA10( nbTETRA10, umesh3);
283 getPYRA5(nbPYRA5, umesh3);
288 getHEXA8( nbHEXA8, umesh3);
294 getHEXA20( nbHEXA20, umesh3);
300 getHEXA27 (nbHEXA27, umesh3);
306 getPENTA6(nbPENTA6, umesh3);
313 return MeshFormat::DRS_OK;
317 MeshFormat::Status MeshFormatWriter::performFields()
320 MeshFormat::Status status = MeshFormat::Status::DRS_OK;
322 if (_fields.size() != _fieldFileNames.size() )
324 addMessage( MeshFormat::Comment(" Number of fields and number of input *.sol files must be equal ") << _meshFileName, /*fatal=*/true );
325 status = MeshFormat::Status::DRS_FAIL;
330 int dim = _mesh->getMeshDimension(); // dim mesh field lying to
331 std::vector<std::string>::const_iterator fieldFileIt = _fieldFileNames.begin();
333 std::vector<int> levs {0} ;
334 for (; fieldFileIt !=_fieldFileNames.end(); ++fieldFileIt)
337 _myCurrentOpenFile = *fieldFileIt;
339 MEDCoupling::MEDFileFieldMultiTS* f = _fields[iField];
343 if ( f->getMeshName() == _mesh->getName() )
346 std::vector< std::vector<MEDCoupling::TypeOfField> > fTypes = f->getTypesOfFieldAvailable();
347 std::vector< std::pair<int,int> > iters = f->getIterations();
348 const std::vector<std::string>& compInfo = f->getInfo();
349 std::pair<int,int> it = iters[0];
351 //~// Open File for writing
352 _myCurrentFileId = _writer.GmfOpenMesh( fieldFileIt->c_str(), GmfWrite, _version, _dim );
354 if ( fTypes[0].size() == 1 && fTypes[0][0] == MEDCoupling::ON_NODES )
356 setFieldOnNodes(f, it.first, it.second, compInfo.size());
360 setFieldOnCells( f, it.first, it.second, levs );
363 _writer.GmfCloseMesh( _myCurrentFileId );
373 MeshFormat::Status MeshFormatWriter::setFieldOnNodes(MEDCoupling::MEDFileFieldMultiTS * f, int iteration, int order, size_t compSize)
377 std::vector<INTERP_KERNEL::NormalizedCellType> types;
378 std::vector< std::vector<MEDCoupling::TypeOfField> > typesF;
379 std::vector< std::vector<std::string> > pfls, locs;
380 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > valsVec;
381 valsVec = f->getFieldSplitedByType( iteration, order, _mesh->getName().c_str(),
382 types, typesF, pfls, locs);
383 // believe that there can be only one type in a nodal field,
384 // so do not perform a loop on types
385 const MEDCoupling::DataArrayDouble* valsArray = f->getUndergroundDataArray(iteration, order);
386 int typTab[] = { getGmfSolKwd((int)compSize, _dim) };
387 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfSolAtVertices, (int)valsVec[0][0].second, 1, typTab);
388 double* valTab0 = new double[compSize];
390 for ( size_t i = valsVec[0][0].first; i < (std::size_t)valsVec[0][0].second; ++i )
393 for ( size_t j = 0; j < compSize; ++j )
394 valTab0[j] = valsArray->getIJ( i, j );
396 if (compSize == 9 || compSize == 4){ // full matrix ==>uper triangular matrix
397 extractSymetricTensor(valTab0, valTab);
398 _writer.GmfSetLin( _myCurrentFileId, MeshFormat::GmfSolAtVertices, valTab);
403 _writer.GmfSetLin( _myCurrentFileId, MeshFormat::GmfSolAtVertices, valTab0);
408 return MeshFormat::Status::DRS_OK;
412 MeshFormat::Status MeshFormatWriter::setFieldOnCells(MEDCoupling::MEDFileFieldMultiTS * f, int iteration, int order, std::vector<int> levs )
415 int dim = _mesh->getMeshDimension(); // dim mesh field lying to
416 int absDim = f->getNonEmptyLevels(iteration, order, f->getMeshName(), levs);
418 MEDCoupling::MEDCouplingFieldDouble** cellToNodeFldb = new MEDCoupling::MEDCouplingFieldDouble* [(int)levs.size()] ;
419 MEDCoupling::MEDCouplingFieldDouble** fldb = new MEDCoupling::MEDCouplingFieldDouble* [(int)levs.size()] ;
421 for (size_t k = 0; k<levs.size(); k++) fldb[k] = f->field( iteration, order,_mesh );
423 // turn it node discretization
424 for (size_t l = 0; l < levs.size(); l++) cellToNodeFldb[l] = fldb[l]->cellToNodeDiscretization() ;
426 for(size_t j =0; j < levs.size(); j++ )
429 const mcIdType pointsNumber = cellToNodeFldb[j]->getNumberOfTuples();
430 const mcIdType nbComp = (int) cellToNodeFldb[j]->getNumberOfComponents() ;
432 MEDCoupling::DataArrayDouble* timeStamp = cellToNodeFldb[j]->getArray();
433 double* values = timeStamp->getPointer();
435 int typ = getGmfSolKwd((int)nbComp, _dim) ;
438 addMessage( MeshFormat::Comment(" error with Number of Component ") << nbComp, /*fatal=*/true );
439 return MeshFormat::Status::DRS_FAIL;
442 int typTab[] = {typ};
443 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfSolAtVertices, pointsNumber, 1, typTab);
447 for (int i = 0; i < pointsNumber ; i++ )
450 double valTab0[10]; //max 3x3 matrix +1 for safety ;)
452 std::copy(values, values+nbComp, valTab0);
454 if (nbComp == 9 || nbComp == 4) // full matrix ==>uper triangular matrix
456 extractSymetricTensor(valTab0, valTab);
457 _writer.GmfSetLin( _myCurrentFileId, MeshFormat::GmfSolAtVertices, valTab);
460 else //sym mat, scalar or vec
462 valTab = new double[nbComp];
463 std::copy(valTab0, valTab0+nbComp, valTab);
464 _writer.GmfSetLin( _myCurrentFileId, MeshFormat::GmfSolAtVertices, valTab);
474 for(size_t i = 0; i < levs.size(); i++ ) fldb[i]->decrRef();
475 for(size_t i = 0; i < levs.size(); i++ ) cellToNodeFldb[i]->decrRef();
476 delete [] cellToNodeFldb;
479 return MeshFormat::Status::DRS_OK;
482 |*| extract the upper triangular matrix of fullTensor
483 |*| if _dim == 2 fill symTensor with values at index 0, 1 & 3 of fullTensor
486 |*| if _dim == 3 fill symTensor with values at index 0, 1, 2, 4, 5 & 8 of fullTensor
491 void MeshFormatWriter::extractSymetricTensor(double fullTensor[], double*& symTensor)
493 symTensor = new double[_dim*(_dim+1)/2];
494 for (int ii =0; ii<_dim; ii++)
495 for (int jj =ii; jj<_dim; jj++)
497 int kk = _dim*(_dim-1)/2- (_dim-ii)*(_dim-ii-1)/2+jj;
498 symTensor[kk] = fullTensor[ii+jj*_dim];
501 int MeshFormatWriter::getGmfSolKwd(const int nbComp, const int dim)
503 if (nbComp== 1) return GmfSca;
504 else if( dim == nbComp) return GmfVec;
505 else if (dim*(dim+1)/2 == nbComp || dim*dim == nbComp ) return GmfSymMat;
506 //~else if (dim*dim == nbComp) return GmfMat; // Not valid in mg-adapt if not sym
509 bool MeshFormatWriter::checkFileName()
514 bool MeshFormatWriter::checkFieldFileName()
521 std::string MeshFormatWriter::getMeshFileName() const
523 return _meshFileName;
527 std::vector<std::string> MeshFormatWriter::getFieldFileNames() const
529 return _fieldFileNames;
532 MeshFormat::Status MeshFormatWriter::addMessage(const std::string& msg,
533 const bool isFatal/*=false*/)
536 _myErrorMessages.clear(); // warnings are useless if a fatal error encounters
538 _myErrorMessages.push_back( msg );
542 std::cout << msg << std::endl;
544 return ( _myStatus = isFatal ? MeshFormat::DRS_FAIL : MeshFormat::DRS_WARN_SKIP_ELEM );
548 void MeshFormatWriter::forward_shift(std::vector<MEDCoupling::mcIdType> &conn)
550 std::vector<MEDCoupling::mcIdType>::iterator it = conn.begin();
551 for (; it != conn.end(); ++it) *it = *it+1;
555 void MeshFormatWriter::getNodes(MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh0)
557 MEDCoupling::mcIdType nbNodes = 0;
558 nbNodes = umesh0->getNumberOfNodes();
562 MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> coordArray = umesh0->getCoordinatesAndOwner();
563 double* coordPrt = coordArray->getPointer();
564 _writer.GmfSetKwd( _myCurrentFileId, MeshFormat::GmfVertices, nbNodes );
566 int j = (int)nbNodes;
573 std::copy(coordPrt, coordPrt+_dim, xyz);
575 MeshFormatNode e(xyz[0], xyz[1], xyz[2], idNode);
576 _idNodeToNode.insert(std::pair <int, MeshFormatNode> (idNode, e));
583 std::map <int, MeshFormatNode>::iterator itNode = _idNodeToNode.begin();
584 for (; itNode!= _idNodeToNode.end(); ++itNode)
585 _dim == 3? _writer.GmfSetLin( _myCurrentFileId, MeshFormat::GmfVertices, itNode->second.xyz[0],
586 itNode->second.xyz[1], itNode->second.xyz[2], std::abs(itNode->second._famId) ) :
587 _writer.GmfSetLin( _myCurrentFileId, MeshFormat::GmfVertices, itNode->second.xyz[0],
588 itNode->second.xyz[1], std::abs(itNode->second._famId) );
592 void MeshFormatWriter::getNSEG2(MEDCoupling::mcIdType nbEdgesNSEG2, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh1)
595 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh1->giveCellsWithType(INTERP_KERNEL::NORM_SEG2);
596 std::map<int, MeshFormatCell> idCellToCell;
597 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
599 std::vector<MEDCoupling::mcIdType> conn;
600 umesh1->getNodeIdsOfCell(*it, conn) ;
603 MeshFormatCell e(INTERP_KERNEL::NORM_SEG2, (int)*it);
605 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
607 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_SEG2, idCellToCell) );
611 void MeshFormatWriter::getNSEG3( MEDCoupling::mcIdType nbEdgesNSEG3, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh1)
615 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh1->giveCellsWithType(INTERP_KERNEL::NORM_SEG3);
616 std::map<int, MeshFormatCell> idCellToCell;
617 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
620 std::vector<MEDCoupling::mcIdType> conn;
621 umesh1->getNodeIdsOfCell(*it, conn) ;
623 MeshFormatCell e(INTERP_KERNEL::NORM_SEG3, (int)*it);
625 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
627 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_SEG3, idCellToCell) );
631 void MeshFormatWriter::getTRI3( MEDCoupling::mcIdType nbTRI3, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
634 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_TRI3);
635 std::map<int, MeshFormatCell> idCellToCell;
636 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
638 std::vector<MEDCoupling::mcIdType> conn;
639 umesh2->getNodeIdsOfCell(*it, conn) ;
641 MeshFormatCell e(INTERP_KERNEL::NORM_TRI3, (int)*it);
643 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
645 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_TRI3, idCellToCell) );
649 void MeshFormatWriter::getTRI6( MEDCoupling::mcIdType nbTRI6, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
652 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_TRI6);
653 std::map<int, MeshFormatCell> idCellToCell;
654 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
656 std::vector<MEDCoupling::mcIdType> conn;
657 umesh2->getNodeIdsOfCell(*it, conn) ;
659 MeshFormatCell e(INTERP_KERNEL::NORM_TRI6, (int)*it);
661 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
664 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_TRI6, idCellToCell) );
667 void MeshFormatWriter::getQUAD4( MEDCoupling::mcIdType nbQUAD4, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
670 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_QUAD4);
671 std::map<int, MeshFormatCell> idCellToCell;
672 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
674 std::vector<MEDCoupling::mcIdType> conn;
675 umesh2->getNodeIdsOfCell(*it, conn) ;
677 MeshFormatCell e(INTERP_KERNEL::NORM_QUAD4, (int)*it);
679 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
681 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_QUAD4, idCellToCell) );
684 void MeshFormatWriter::getQUAD8(MEDCoupling::mcIdType nbQUAD8, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
687 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_QUAD8);
688 std::map<int, MeshFormatCell> idCellToCell;
689 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
691 std::vector<MEDCoupling::mcIdType> conn;
692 umesh2->getNodeIdsOfCell(*it, conn) ;
694 MeshFormatCell e(INTERP_KERNEL::NORM_QUAD8, (int)*it);
696 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
698 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_QUAD8, idCellToCell) );
701 void MeshFormatWriter::getQUAD9(MEDCoupling::mcIdType nbQUAD9, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
704 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_QUAD9);
705 std::map<int, MeshFormatCell> idCellToCell;
706 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
708 std::vector<MEDCoupling::mcIdType> conn;
709 umesh2->getNodeIdsOfCell(*it, conn) ;
711 MeshFormatCell e(INTERP_KERNEL::NORM_QUAD9, (int)*it);
713 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
716 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_QUAD9, idCellToCell) );
719 void MeshFormatWriter::getTETRA4(MEDCoupling::mcIdType nbTETRA4, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
722 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_TETRA4);
723 std::map<int, MeshFormatCell> idCellToCell;
724 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
726 std::vector<MEDCoupling::mcIdType> conn;
727 umesh3->getNodeIdsOfCell(*it, conn) ;
729 MeshFormatCell e(INTERP_KERNEL::NORM_TETRA4, (int)*it);
731 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
734 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_TETRA4, idCellToCell) );
737 void MeshFormatWriter::getTETRA10(MEDCoupling::mcIdType nbTETRA10, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
740 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_TETRA10);
741 std::map<int, MeshFormatCell> idCellToCell;
742 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
744 std::vector<MEDCoupling::mcIdType> conn;
745 umesh3->getNodeIdsOfCell(*it, conn) ;
747 MeshFormatCell e(INTERP_KERNEL::NORM_TETRA10, (int)*it);
749 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
751 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_TETRA10, idCellToCell) );
754 void MeshFormatWriter::getPYRA5(MEDCoupling::mcIdType nbPYRA5, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
757 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_PYRA5);
758 std::map<int, MeshFormatCell> idCellToCell;
759 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
761 std::vector<MEDCoupling::mcIdType> conn;
762 umesh3->getNodeIdsOfCell(*it, conn) ;
764 MeshFormatCell e(INTERP_KERNEL::NORM_PYRA5, (int)*it);
766 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
768 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_PYRA5, idCellToCell) );
771 void MeshFormatWriter::getHEXA8(MEDCoupling::mcIdType nbHEXA8, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
774 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_HEXA8);
775 std::map<int, MeshFormatCell> idCellToCell;
776 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
778 std::vector<MEDCoupling::mcIdType> conn;
779 umesh3->getNodeIdsOfCell(*it, conn) ;
781 MeshFormatCell e(INTERP_KERNEL::NORM_HEXA8, (int)*it);
783 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
785 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_HEXA8, idCellToCell) );
787 void MeshFormatWriter::getHEXA20(MEDCoupling::mcIdType nbHEXA20, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
790 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_HEXA20);
791 std::map<int, MeshFormatCell> idCellToCell;
792 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
794 std::vector<MEDCoupling::mcIdType> conn;
795 umesh3->getNodeIdsOfCell(*it, conn) ;
797 MeshFormatCell e(INTERP_KERNEL::NORM_HEXA20, (int)*it);
799 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
801 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_HEXA20, idCellToCell) );
803 void MeshFormatWriter::getHEXA27(MEDCoupling::mcIdType nbHEXA27, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
806 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_HEXA27);
807 std::map<int, MeshFormatCell> idCellToCell;
808 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
810 std::vector<MEDCoupling::mcIdType> conn;
811 umesh3->getNodeIdsOfCell(*it, conn) ;
813 MeshFormatCell e(INTERP_KERNEL::NORM_HEXA27, (int)*it);
815 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
817 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_HEXA27, idCellToCell) );
820 void MeshFormatWriter::getPENTA6(MEDCoupling::mcIdType nbPENTA6, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
823 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_PENTA6);
824 std::map<int, MeshFormatCell> idCellToCell;
825 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
827 std::vector<MEDCoupling::mcIdType> conn;
828 umesh3->getNodeIdsOfCell(*it, conn) ;
830 MeshFormatCell e(INTERP_KERNEL::NORM_PENTA6, (int)*it);
832 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
834 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_PENTA6, idCellToCell) );
838 void MeshFormatWriter::linkFamilyToNodes()
841 std::map<std::string,mcIdType> famInfos = _mesh->getFamilyInfo();
842 std::map<std::string,mcIdType>::const_iterator famIt = famInfos.begin();
843 for (; famIt != famInfos.end(); ++famIt)
845 if(!famIt->second) continue; //FAMILLE_ZERO
846 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> nodeIds = _mesh->getNodeFamilyArr(famIt->first);
847 const MEDCoupling::mcIdType * nodeIdsIt = nodeIds->begin(), * famIDEnd = nodeIds->end();
848 for(; nodeIdsIt< famIDEnd; ++nodeIdsIt) {
850 std::map <int, MeshFormatNode>::iterator itNode = _idNodeToNode.find((int)*nodeIdsIt);
851 if (itNode == _idNodeToNode.end()) continue;
852 else itNode->second._famId =(int) famIt->second;
861 void MeshFormatWriter::linkFamilyToCells()
864 std::vector<int> levs = _mesh->getNonEmptyLevels();
865 for (size_t iDim = 0; iDim < levs.size(); iDim++ )
867 int meshDimRelToMax = levs[iDim];
868 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingMesh > mesh = _mesh->getMeshAtLevel( meshDimRelToMax);
869 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh0 = mesh->buildUnstructured();
870 const MEDCoupling::DataArrayIdType * famIds = _mesh->getFamilyFieldAtLevel(meshDimRelToMax);
871 const MEDCoupling::mcIdType * famID = famIds->begin(), *famIDEnd = famIds->end();
872 for (; famID < famIDEnd; ++famID)
874 if (!(*famID)) continue; // "FAMILLE_ZERO"
875 std::string famName = _mesh->getFamilyNameGivenId(*famID);
876 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> cellIds = _mesh->getFamilyArr( meshDimRelToMax, famName);
877 const MEDCoupling::mcIdType * cellIdsIt = cellIds->begin(), *cellIDEnd = cellIds->end();
878 for(; cellIdsIt< cellIDEnd; ++cellIdsIt)
880 INTERP_KERNEL::NormalizedCellType type = umesh0->getTypeOfCell(*cellIdsIt); //TODO
881 std::map<INTERP_KERNEL::NormalizedCellType, std::map <int, MeshFormatCell> >::iterator itCellMap = _typeToIdCellToCell.find(type);
882 if (itCellMap == _typeToIdCellToCell.end()) continue;
885 std::map <int, MeshFormatCell>::iterator itCell = itCellMap->second.find((int)*cellIdsIt);
886 if (itCell == itCellMap->second.end()) continue;
887 else itCell->second._famId = (int)*famID;
897 void MeshFormatWriter::writeCells()
900 std::map < INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >::iterator typeCellMapIt = _typeToIdCellToCell.begin();
901 for (; typeCellMapIt!= _typeToIdCellToCell.end(); ++typeCellMapIt)
903 std::map<int, MeshFormatCell>::iterator cellMapIt = typeCellMapIt->second.begin();
904 switch (typeCellMapIt->first)
906 case INTERP_KERNEL::NORM_SEG2 :
909 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfEdges, (int)typeCellMapIt->second.size());
911 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
913 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
914 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfEdges, conn[0], conn[1], std::abs(cellMapIt->second._famId) );
918 case INTERP_KERNEL::NORM_SEG3 :
921 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfEdges, (int)typeCellMapIt->second.size());
922 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
924 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
925 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfEdges, conn[0], conn[1], std::abs(cellMapIt->second._famId) );
927 cellMapIt = typeCellMapIt->second.begin();
929 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtEdges, (int)typeCellMapIt->second.size());
931 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
933 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
934 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtEdges, cellMapIt->first+1, 1, conn[2] );
938 case INTERP_KERNEL::NORM_TRI3 :
941 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfTriangles, (int)typeCellMapIt->second.size());
943 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
945 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
946 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfTriangles, conn[0], conn[1], conn[2], std::abs(cellMapIt->second._famId) );
950 case INTERP_KERNEL::NORM_TRI6 :
953 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfTriangles, (int)typeCellMapIt->second.size());
954 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
956 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
957 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfTriangles, conn[0], conn[1], conn[2], std::abs(cellMapIt->second._famId) );
960 cellMapIt = typeCellMapIt->second.begin();
961 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtTriangles, (int)typeCellMapIt->second.size());
963 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
965 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
966 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtTriangles, cellMapIt->first+1, 3, conn[3], conn[4], conn[5] );
970 case INTERP_KERNEL::NORM_QUAD4 :
973 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfQuadrilaterals, (int)typeCellMapIt->second.size());
975 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
977 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
978 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfQuadrilaterals, conn[0], conn[1], conn[2], conn[3], std::abs(cellMapIt->second._famId) );
982 case INTERP_KERNEL::NORM_QUAD8 :
985 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfQuadrilaterals, (int)typeCellMapIt->second.size());
986 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
988 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
989 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfQuadrilaterals, conn[0], conn[1], conn[2], conn[3], std::abs(cellMapIt->second._famId) );
991 cellMapIt = typeCellMapIt->second.begin();
992 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtQuadrilaterals, (int)typeCellMapIt->second.size());
994 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
996 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
997 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtQuadrilaterals, cellMapIt->first+1, 4, conn[4], conn[5],
1002 case INTERP_KERNEL::NORM_QUAD9 :
1005 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfQuadrilaterals, (int)typeCellMapIt->second.size());
1006 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1008 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1009 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfQuadrilaterals, conn[0], conn[1], conn[2], conn[3], std::abs(cellMapIt->second._famId) );
1011 cellMapIt = typeCellMapIt->second.begin();
1012 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtQuadrilaterals, (int)typeCellMapIt->second.size());
1014 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1016 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1017 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtQuadrilaterals,cellMapIt->first+1, 5, conn[4], conn[5],
1018 conn[6], conn[7], conn[8] );
1022 case INTERP_KERNEL::NORM_TETRA4 :
1025 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfTetrahedra, (int)typeCellMapIt->second.size());
1027 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1029 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1030 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfTetrahedra, conn[0], conn[2], conn[1], conn[3], std::abs(cellMapIt->second._famId) );
1034 case INTERP_KERNEL::NORM_TETRA10 :
1037 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtTetrahedra, (int)typeCellMapIt->second.size());
1038 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1040 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1041 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfTetrahedra, conn[0], conn[2], conn[1], conn[3], std::abs(cellMapIt->second._famId) );
1043 cellMapIt = typeCellMapIt->second.begin();
1044 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfTetrahedra, (int)typeCellMapIt->second.size());
1046 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1048 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1049 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtTetrahedra, cellMapIt->first+1, 6, conn[6], conn[5],
1050 conn[4], conn[7], conn[8], conn[9] );
1054 case INTERP_KERNEL::NORM_PYRA5 :
1057 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfPyramids, (int)typeCellMapIt->second.size());
1059 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1061 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1062 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfPyramids, conn[3], conn[2], conn[1], conn[0], conn[4], std::abs(cellMapIt->second._famId) );
1067 case INTERP_KERNEL::NORM_HEXA8 :
1070 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfHexahedra, (int)typeCellMapIt->second.size());
1072 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1074 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1075 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfHexahedra, conn[0], conn[3], conn[2], conn[1], conn[4], conn[7], conn[6], conn[5], std::abs(cellMapIt->second._famId) );
1080 case INTERP_KERNEL::NORM_HEXA20 :
1083 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfHexahedra, (int)typeCellMapIt->second.size());
1084 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1086 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1087 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfHexahedra, conn[0], conn[3], conn[2], conn[1],
1088 conn[4], conn[7], conn[6], conn[5], std::abs(cellMapIt->second._famId) );
1090 cellMapIt = typeCellMapIt->second.begin();
1091 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtHexahedra, (int)typeCellMapIt->second.size());
1093 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1095 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1096 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtHexahedra, cellMapIt->first+1, 12, conn[11], conn[10], conn[9],
1097 conn[8], conn[15], conn[14], conn[13], conn[12], conn[16], conn[19], conn[18], conn[17] );
1101 case INTERP_KERNEL::NORM_HEXA27 :
1104 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfHexahedra, (int)typeCellMapIt->second.size());
1105 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1107 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1108 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtHexahedra, conn[0], conn[3], conn[2], conn[1],
1109 conn[4], conn[7], conn[6], conn[5], std::abs(cellMapIt->second._famId) );
1111 cellMapIt = typeCellMapIt->second.begin();
1112 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtHexahedra, (int)typeCellMapIt->second.size());
1114 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1116 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1117 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtHexahedra, cellMapIt->first+1, 19, conn[11], conn[10], conn[9],
1118 conn[8], conn[15], conn[14], conn[13], conn[12], conn[16], conn[19], conn[18], conn[17],
1119 conn[20], conn[24], conn[23], conn[22], conn[21], conn[25], conn[26], std::abs(cellMapIt->second._famId) );
1123 case INTERP_KERNEL::NORM_PENTA6 :
1126 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfPrisms, (int)typeCellMapIt->second.size());
1128 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1130 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1131 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfPrisms, conn[0], conn[2], conn[1], conn[3], conn[5], conn[4], std::abs(cellMapIt->second._famId) );