1 // Copyright (C) 2021-2024 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();
79 for (int i = 0; i<fields->getNumberOfFields(); i++ )
81 MEDCoupling::MEDFileAnyTypeFieldMultiTS* field = fields->getFieldAtPos(i);
82 MEDCoupling::MEDFileFieldMultiTS * f = dynamic_cast<MEDCoupling::MEDFileFieldMultiTS *>(field);
90 void MeshFormatWriter::write()
93 MeshFormat::Localizer loc;
95 MEDCoupling::MCAuto<MEDCoupling::MEDCouplingMesh > mesh = _mesh->getMeshAtLevel( 1 );
96 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh = mesh->buildUnstructured();
97 _dim = umesh->getSpaceDimension();
99 if (_dim != 2 && _dim != 3)
101 addMessage( MeshFormat::Comment("Only 3D or 2D mesh allowed! ") << _meshFileName, /*fatal=*/true );
106 _version = sizeof(double) < 8 ? 1 : 2;
107 _writer = MeshFormat::MeshFormatParser();
108 _myCurrentOpenFile = _meshFileName;
109 _myCurrentFileId = _writer.GmfOpenMesh( _meshFileName.c_str(), GmfWrite, _version, _dim );
110 if ( !_myCurrentFileId )
112 if ( MeshFormat::isMeshExtensionCorrect( _meshFileName ))
114 addMessage( MeshFormat::Comment("Can't open for writing ") << _meshFileName, /*fatal=*/true );
120 addMessage( MeshFormat::Comment("Not '.mesh' or '.meshb' extension of file ") << _meshFileName, /*fatal=*/true );
128 _writer.GmfCloseMesh(_myCurrentFileId);
129 _myCurrentFileId = -1;
130 _myCurrentOpenFile = "";
131 if (_fields.size()) performFields();
136 MeshFormat::Status MeshFormatWriter::perform()
140 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingMesh > mesh1;
141 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh1;
142 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingMesh > mesh2;
143 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2;
144 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingMesh > mesh3;
145 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3;
147 std::vector<int> dims = _mesh->getNonEmptyLevelsExt();
148 int dim = _mesh->getMeshDimension();
149 bool threeDElements = false;
150 bool twoDElements = false;
151 bool OneDElements = false;
152 if (dims.size() != 0)
154 bool maxLevelDimElments = ( std::find(dims.begin(), dims.end(), 0) != dims.end() );
155 bool nextToMaxLevelDimElments = ( std::find(dims.begin(), dims.end(), -1) != dims.end() );
156 bool nextToNextToMaxLevelDimElments = (std::find(dims.begin(), dims.end(), -2) != dims.end() );
157 threeDElements = (dim == 3) ? maxLevelDimElments : false ;
158 twoDElements = (dim == 3) ? nextToMaxLevelDimElments : maxLevelDimElments ;
159 OneDElements = (dim == 3) ? nextToNextToMaxLevelDimElments : nextToMaxLevelDimElments;
162 MEDCoupling::mcIdType nbEdgesNSEG2 = 0;
163 MEDCoupling::mcIdType nbEdgesNSEG3 = 0;
164 MEDCoupling::mcIdType nbTRI3 = 0;
165 MEDCoupling::mcIdType nbTRI6 = 0;
166 MEDCoupling::mcIdType nbQUAD4 = 0;
167 MEDCoupling::mcIdType nbQUAD8 = 0;
168 MEDCoupling::mcIdType nbQUAD9 = 0;
169 MEDCoupling::mcIdType nbTETRA4 = 0;
170 MEDCoupling::mcIdType nbTETRA10 = 0;
171 MEDCoupling::mcIdType nbPYRA5 = 0;
172 MEDCoupling::mcIdType nbHEXA8 = 0;
173 MEDCoupling::mcIdType nbHEXA20 = 0;
174 MEDCoupling::mcIdType nbHEXA27 = 0;
175 MEDCoupling::mcIdType nbPENTA6 = 0;
179 mesh1 = _mesh->getMeshAtLevel( 1-dim );
180 umesh1 = mesh1->buildUnstructured();
181 nbEdgesNSEG2 = umesh1->getNumberOfCellsWithType(INTERP_KERNEL::NORM_SEG2);
183 nbEdgesNSEG3 = umesh1->getNumberOfCellsWithType(INTERP_KERNEL::NORM_SEG3);
188 mesh2 = _mesh->getMeshAtLevel( 2-dim );
189 umesh2 = mesh2->buildUnstructured();
190 nbTRI3 = umesh2->getNumberOfCellsWithType(INTERP_KERNEL::NORM_TRI3);
192 nbTRI6 = umesh2->getNumberOfCellsWithType(INTERP_KERNEL::NORM_TRI6);
194 nbQUAD4 = umesh2->getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4);
196 nbQUAD8 = umesh2->getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD8);
198 nbQUAD9 = umesh2->getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD9);
204 mesh3 = _mesh->getMeshAtLevel( 3-dim );
205 umesh3 = mesh3->buildUnstructured();
206 nbTETRA4 = umesh3->getNumberOfCellsWithType(INTERP_KERNEL::NORM_TETRA4);
208 nbTETRA10 = umesh3->getNumberOfCellsWithType(INTERP_KERNEL::NORM_TETRA10);
210 nbPYRA5 = umesh3->getNumberOfCellsWithType(INTERP_KERNEL::NORM_PYRA5);
212 nbHEXA8 = umesh3->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8);
214 nbHEXA20 = umesh3->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA20);
216 nbHEXA27 = umesh3->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA27);
218 nbPENTA6 = umesh3->getNumberOfCellsWithType(INTERP_KERNEL::NORM_PENTA6);
224 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingMesh > mesh0 = _mesh->getMeshAtLevel(1);
225 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh0 = mesh0->buildUnstructured();
231 if ( nbEdgesNSEG2 > 0)
233 getNSEG2( nbEdgesNSEG2, umesh1);
235 //~// nodes of quadratic edges SEG3
236 if ( nbEdgesNSEG3 > 0)
238 getNSEG3( nbEdgesNSEG3, umesh1);
244 getTRI3( nbTRI3, umesh2);
247 // nodes of quadratic triangles
251 getTRI6( nbTRI6, umesh2);
254 //~// quadrangles QUAD4
257 getQUAD4(nbQUAD4, umesh2);
260 //~// quadrangles quadratic QUAD8
263 getQUAD8( nbQUAD8, umesh2);
266 //~// quadrangles quadratic QUAD9
269 getQUAD9( nbQUAD9, umesh2);
275 getTETRA4( nbTETRA4, umesh3);
280 getTETRA10( nbTETRA10, umesh3);
286 getPYRA5(nbPYRA5, umesh3);
291 getHEXA8( nbHEXA8, umesh3);
297 getHEXA20( nbHEXA20, umesh3);
303 getHEXA27 (nbHEXA27, umesh3);
309 getPENTA6(nbPENTA6, umesh3);
316 return MeshFormat::DRS_OK;
320 MeshFormat::Status MeshFormatWriter::performFields()
323 MeshFormat::Status status = MeshFormat::Status::DRS_OK;
325 if (_fields.size() != _fieldFileNames.size() )
327 addMessage( MeshFormat::Comment(" Number of fields and number of input *.sol files must be equal ") << _meshFileName, /*fatal=*/true );
328 status = MeshFormat::Status::DRS_FAIL;
333 int dim = _mesh->getMeshDimension(); // dim mesh field lying to
334 std::vector<std::string>::const_iterator fieldFileIt = _fieldFileNames.begin();
336 std::vector<int> levs {0} ;
337 for (; fieldFileIt !=_fieldFileNames.end(); ++fieldFileIt)
340 _myCurrentOpenFile = *fieldFileIt;
342 MEDCoupling::MEDFileFieldMultiTS* f = _fields[iField];
346 if ( f->getMeshName() == _mesh->getName() )
349 std::vector< std::vector<MEDCoupling::TypeOfField> > fTypes = f->getTypesOfFieldAvailable();
350 std::vector< std::pair<int,int> > iters = f->getIterations();
351 const std::vector<std::string>& compInfo = f->getInfo();
352 std::pair<int,int> it = iters[0];
354 //~// Open File for writing
355 _myCurrentFileId = _writer.GmfOpenMesh( fieldFileIt->c_str(), GmfWrite, _version, _dim );
357 if ( fTypes[0].size() == 1 && fTypes[0][0] == MEDCoupling::ON_NODES )
359 setFieldOnNodes(f, it.first, it.second, compInfo.size());
363 setFieldOnCells( f, it.first, it.second, levs );
366 _writer.GmfCloseMesh( _myCurrentFileId );
376 MeshFormat::Status MeshFormatWriter::setFieldOnNodes(MEDCoupling::MEDFileFieldMultiTS * f, int iteration, int order, size_t compSize)
380 std::vector<INTERP_KERNEL::NormalizedCellType> types;
381 std::vector< std::vector<MEDCoupling::TypeOfField> > typesF;
382 std::vector< std::vector<std::string> > pfls, locs;
383 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > valsVec;
384 valsVec = f->getFieldSplitedByType( iteration, order, _mesh->getName().c_str(),
385 types, typesF, pfls, locs);
386 // believe that there can be only one type in a nodal field,
387 // so do not perform a loop on types
388 const MEDCoupling::DataArrayDouble* valsArray = f->getUndergroundDataArray(iteration, order);
389 int typTab[] = { getGmfSolKwd((int)compSize, _dim) };
390 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfSolAtVertices, (int)valsVec[0][0].second, 1, typTab);
391 double* valTab0 = new double[compSize];
393 for ( size_t i = valsVec[0][0].first; i < (std::size_t)valsVec[0][0].second; ++i )
396 for ( size_t j = 0; j < compSize; ++j )
397 valTab0[j] = valsArray->getIJ( i, j );
399 if (compSize == 9 || compSize == 4){ // full matrix ==>uper triangular matrix
400 extractSymetricTensor(valTab0, valTab);
401 _writer.GmfSetLin( _myCurrentFileId, MeshFormat::GmfSolAtVertices, valTab);
406 _writer.GmfSetLin( _myCurrentFileId, MeshFormat::GmfSolAtVertices, valTab0);
411 return MeshFormat::Status::DRS_OK;
415 MeshFormat::Status MeshFormatWriter::setFieldOnCells(MEDCoupling::MEDFileFieldMultiTS * f, int iteration, int order, std::vector<int> levs )
418 int dim = _mesh->getMeshDimension(); // dim mesh field lying to
419 int absDim = f->getNonEmptyLevels(iteration, order, f->getMeshName(), levs);
421 MEDCoupling::MEDCouplingFieldDouble** cellToNodeFldb = new MEDCoupling::MEDCouplingFieldDouble* [(int)levs.size()] ;
422 MEDCoupling::MEDCouplingFieldDouble** fldb = new MEDCoupling::MEDCouplingFieldDouble* [(int)levs.size()] ;
424 for (size_t k = 0; k<levs.size(); k++) fldb[k] = f->field( iteration, order,_mesh );
426 // turn it node discretization
427 for (size_t l = 0; l < levs.size(); l++) cellToNodeFldb[l] = fldb[l]->cellToNodeDiscretization() ;
429 for(size_t j =0; j < levs.size(); j++ )
432 const mcIdType pointsNumber = cellToNodeFldb[j]->getNumberOfTuples();
433 const mcIdType nbComp = (int) cellToNodeFldb[j]->getNumberOfComponents() ;
435 MEDCoupling::DataArrayDouble* timeStamp = cellToNodeFldb[j]->getArray();
436 double* values = timeStamp->getPointer();
438 int typ = getGmfSolKwd((int)nbComp, _dim) ;
441 addMessage( MeshFormat::Comment(" error with Number of Component ") << nbComp, /*fatal=*/true );
442 return MeshFormat::Status::DRS_FAIL;
445 int typTab[] = {typ};
446 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfSolAtVertices, pointsNumber, 1, typTab);
450 for (int i = 0; i < pointsNumber ; i++ )
453 double valTab0[10]; //max 3x3 matrix +1 for safety ;)
455 std::copy(values, values+nbComp, valTab0);
457 if (nbComp == 9 || nbComp == 4) // full matrix ==>uper triangular matrix
459 extractSymetricTensor(valTab0, valTab);
460 _writer.GmfSetLin( _myCurrentFileId, MeshFormat::GmfSolAtVertices, valTab);
463 else //sym mat, scalar or vec
465 valTab = new double[nbComp];
466 std::copy(valTab0, valTab0+nbComp, valTab);
467 _writer.GmfSetLin( _myCurrentFileId, MeshFormat::GmfSolAtVertices, valTab);
477 for(size_t i = 0; i < levs.size(); i++ ) fldb[i]->decrRef();
478 for(size_t i = 0; i < levs.size(); i++ ) cellToNodeFldb[i]->decrRef();
479 delete [] cellToNodeFldb;
482 return MeshFormat::Status::DRS_OK;
485 |*| extract the upper triangular matrix of fullTensor
486 |*| if _dim == 2 fill symTensor with values at index 0, 1 & 3 of fullTensor
489 |*| if _dim == 3 fill symTensor with values at index 0, 1, 2, 4, 5 & 8 of fullTensor
494 void MeshFormatWriter::extractSymetricTensor(double fullTensor[], double*& symTensor)
496 symTensor = new double[_dim*(_dim+1)/2];
497 for (int ii =0; ii<_dim; ii++)
498 for (int jj =ii; jj<_dim; jj++)
500 int kk = _dim*(_dim-1)/2- (_dim-ii)*(_dim-ii-1)/2+jj;
501 symTensor[kk] = fullTensor[ii+jj*_dim];
504 int MeshFormatWriter::getGmfSolKwd(const int nbComp, const int dim)
506 if (nbComp== 1) return GmfSca;
507 else if( dim == nbComp) return GmfVec;
508 else if (dim*(dim+1)/2 == nbComp || dim*dim == nbComp ) return GmfSymMat;
509 //~else if (dim*dim == nbComp) return GmfMat; // Not valid in mg-adapt if not sym
512 bool MeshFormatWriter::checkFileName()
517 bool MeshFormatWriter::checkFieldFileName()
524 std::string MeshFormatWriter::getMeshFileName() const
526 return _meshFileName;
530 std::vector<std::string> MeshFormatWriter::getFieldFileNames() const
532 return _fieldFileNames;
535 MeshFormat::Status MeshFormatWriter::addMessage(const std::string& msg,
536 const bool isFatal/*=false*/)
539 _myErrorMessages.clear(); // warnings are useless if a fatal error encounters
541 _myErrorMessages.push_back( msg );
545 std::cout << msg << std::endl;
547 return ( _myStatus = isFatal ? MeshFormat::DRS_FAIL : MeshFormat::DRS_WARN_SKIP_ELEM );
551 void MeshFormatWriter::forward_shift(std::vector<MEDCoupling::mcIdType> &conn)
553 std::vector<MEDCoupling::mcIdType>::iterator it = conn.begin();
554 for (; it != conn.end(); ++it) *it = *it+1;
558 void MeshFormatWriter::getNodes(MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh0)
560 MEDCoupling::mcIdType nbNodes = 0;
561 nbNodes = umesh0->getNumberOfNodes();
565 MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> coordArray = umesh0->getCoordinatesAndOwner();
566 double* coordPrt = coordArray->getPointer();
567 _writer.GmfSetKwd( _myCurrentFileId, MeshFormat::GmfVertices, nbNodes );
569 int j = (int)nbNodes;
576 std::copy(coordPrt, coordPrt+_dim, xyz);
578 MeshFormatNode e(xyz[0], xyz[1], xyz[2], idNode);
579 _idNodeToNode.insert(std::pair <int, MeshFormatNode> (idNode, e));
586 std::map <int, MeshFormatNode>::iterator itNode = _idNodeToNode.begin();
587 for (; itNode!= _idNodeToNode.end(); ++itNode)
588 _dim == 3? _writer.GmfSetLin( _myCurrentFileId, MeshFormat::GmfVertices, itNode->second.xyz[0],
589 itNode->second.xyz[1], itNode->second.xyz[2], std::abs(itNode->second._famId) ) :
590 _writer.GmfSetLin( _myCurrentFileId, MeshFormat::GmfVertices, itNode->second.xyz[0],
591 itNode->second.xyz[1], std::abs(itNode->second._famId) );
595 void MeshFormatWriter::getNSEG2(MEDCoupling::mcIdType nbEdgesNSEG2, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh1)
598 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh1->giveCellsWithType(INTERP_KERNEL::NORM_SEG2);
599 std::map<int, MeshFormatCell> idCellToCell;
600 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
602 std::vector<MEDCoupling::mcIdType> conn;
603 umesh1->getNodeIdsOfCell(*it, conn) ;
606 MeshFormatCell e(INTERP_KERNEL::NORM_SEG2, (int)*it);
608 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
610 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_SEG2, idCellToCell) );
614 void MeshFormatWriter::getNSEG3( MEDCoupling::mcIdType nbEdgesNSEG3, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh1)
618 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh1->giveCellsWithType(INTERP_KERNEL::NORM_SEG3);
619 std::map<int, MeshFormatCell> idCellToCell;
620 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
623 std::vector<MEDCoupling::mcIdType> conn;
624 umesh1->getNodeIdsOfCell(*it, conn) ;
626 MeshFormatCell e(INTERP_KERNEL::NORM_SEG3, (int)*it);
628 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
630 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_SEG3, idCellToCell) );
634 void MeshFormatWriter::getTRI3( MEDCoupling::mcIdType nbTRI3, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
637 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_TRI3);
638 std::map<int, MeshFormatCell> idCellToCell;
639 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
641 std::vector<MEDCoupling::mcIdType> conn;
642 umesh2->getNodeIdsOfCell(*it, conn) ;
644 MeshFormatCell e(INTERP_KERNEL::NORM_TRI3, (int)*it);
646 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
648 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_TRI3, idCellToCell) );
652 void MeshFormatWriter::getTRI6( MEDCoupling::mcIdType nbTRI6, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
655 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_TRI6);
656 std::map<int, MeshFormatCell> idCellToCell;
657 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
659 std::vector<MEDCoupling::mcIdType> conn;
660 umesh2->getNodeIdsOfCell(*it, conn) ;
662 MeshFormatCell e(INTERP_KERNEL::NORM_TRI6, (int)*it);
664 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
667 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_TRI6, idCellToCell) );
670 void MeshFormatWriter::getQUAD4( MEDCoupling::mcIdType nbQUAD4, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
673 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_QUAD4);
674 std::map<int, MeshFormatCell> idCellToCell;
675 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
677 std::vector<MEDCoupling::mcIdType> conn;
678 umesh2->getNodeIdsOfCell(*it, conn) ;
680 MeshFormatCell e(INTERP_KERNEL::NORM_QUAD4, (int)*it);
682 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
684 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_QUAD4, idCellToCell) );
687 void MeshFormatWriter::getQUAD8(MEDCoupling::mcIdType nbQUAD8, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
690 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_QUAD8);
691 std::map<int, MeshFormatCell> idCellToCell;
692 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
694 std::vector<MEDCoupling::mcIdType> conn;
695 umesh2->getNodeIdsOfCell(*it, conn) ;
697 MeshFormatCell e(INTERP_KERNEL::NORM_QUAD8, (int)*it);
699 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
701 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_QUAD8, idCellToCell) );
704 void MeshFormatWriter::getQUAD9(MEDCoupling::mcIdType nbQUAD9, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
707 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_QUAD9);
708 std::map<int, MeshFormatCell> idCellToCell;
709 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
711 std::vector<MEDCoupling::mcIdType> conn;
712 umesh2->getNodeIdsOfCell(*it, conn) ;
714 MeshFormatCell e(INTERP_KERNEL::NORM_QUAD9, (int)*it);
716 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
719 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_QUAD9, idCellToCell) );
722 void MeshFormatWriter::getTETRA4(MEDCoupling::mcIdType nbTETRA4, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
725 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_TETRA4);
726 std::map<int, MeshFormatCell> idCellToCell;
727 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
729 std::vector<MEDCoupling::mcIdType> conn;
730 umesh3->getNodeIdsOfCell(*it, conn) ;
732 MeshFormatCell e(INTERP_KERNEL::NORM_TETRA4, (int)*it);
734 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
737 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_TETRA4, idCellToCell) );
740 void MeshFormatWriter::getTETRA10(MEDCoupling::mcIdType nbTETRA10, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
743 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_TETRA10);
744 std::map<int, MeshFormatCell> idCellToCell;
745 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
747 std::vector<MEDCoupling::mcIdType> conn;
748 umesh3->getNodeIdsOfCell(*it, conn) ;
750 MeshFormatCell e(INTERP_KERNEL::NORM_TETRA10, (int)*it);
752 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
754 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_TETRA10, idCellToCell) );
757 void MeshFormatWriter::getPYRA5(MEDCoupling::mcIdType nbPYRA5, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
760 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_PYRA5);
761 std::map<int, MeshFormatCell> idCellToCell;
762 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
764 std::vector<MEDCoupling::mcIdType> conn;
765 umesh3->getNodeIdsOfCell(*it, conn) ;
767 MeshFormatCell e(INTERP_KERNEL::NORM_PYRA5, (int)*it);
769 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
771 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_PYRA5, idCellToCell) );
774 void MeshFormatWriter::getHEXA8(MEDCoupling::mcIdType nbHEXA8, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
777 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_HEXA8);
778 std::map<int, MeshFormatCell> idCellToCell;
779 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
781 std::vector<MEDCoupling::mcIdType> conn;
782 umesh3->getNodeIdsOfCell(*it, conn) ;
784 MeshFormatCell e(INTERP_KERNEL::NORM_HEXA8, (int)*it);
786 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
788 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_HEXA8, idCellToCell) );
790 void MeshFormatWriter::getHEXA20(MEDCoupling::mcIdType nbHEXA20, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
793 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_HEXA20);
794 std::map<int, MeshFormatCell> idCellToCell;
795 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
797 std::vector<MEDCoupling::mcIdType> conn;
798 umesh3->getNodeIdsOfCell(*it, conn) ;
800 MeshFormatCell e(INTERP_KERNEL::NORM_HEXA20, (int)*it);
802 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
804 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_HEXA20, idCellToCell) );
806 void MeshFormatWriter::getHEXA27(MEDCoupling::mcIdType nbHEXA27, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
809 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_HEXA27);
810 std::map<int, MeshFormatCell> idCellToCell;
811 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
813 std::vector<MEDCoupling::mcIdType> conn;
814 umesh3->getNodeIdsOfCell(*it, conn) ;
816 MeshFormatCell e(INTERP_KERNEL::NORM_HEXA27, (int)*it);
818 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
820 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_HEXA27, idCellToCell) );
823 void MeshFormatWriter::getPENTA6(MEDCoupling::mcIdType nbPENTA6, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
826 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_PENTA6);
827 std::map<int, MeshFormatCell> idCellToCell;
828 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
830 std::vector<MEDCoupling::mcIdType> conn;
831 umesh3->getNodeIdsOfCell(*it, conn) ;
833 MeshFormatCell e(INTERP_KERNEL::NORM_PENTA6, (int)*it);
835 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
837 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_PENTA6, idCellToCell) );
841 void MeshFormatWriter::linkFamilyToNodes()
844 std::map<std::string,mcIdType> famInfos = _mesh->getFamilyInfo();
845 std::map<std::string,mcIdType>::const_iterator famIt = famInfos.begin();
846 for (; famIt != famInfos.end(); ++famIt)
848 if(!famIt->second) continue; //FAMILLE_ZERO
849 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> nodeIds = _mesh->getNodeFamilyArr(famIt->first);
850 const MEDCoupling::mcIdType * nodeIdsIt = nodeIds->begin(), * famIDEnd = nodeIds->end();
851 for(; nodeIdsIt< famIDEnd; ++nodeIdsIt) {
853 std::map <int, MeshFormatNode>::iterator itNode = _idNodeToNode.find((int)*nodeIdsIt);
854 if (itNode == _idNodeToNode.end()) continue;
855 else itNode->second._famId =(int) famIt->second;
864 void MeshFormatWriter::linkFamilyToCells()
867 std::vector<int> levs = _mesh->getNonEmptyLevels();
868 for (size_t iDim = 0; iDim < levs.size(); iDim++ )
870 int meshDimRelToMax = levs[iDim];
871 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingMesh > mesh = _mesh->getMeshAtLevel( meshDimRelToMax);
872 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh0 = mesh->buildUnstructured();
873 const MEDCoupling::DataArrayIdType * famIdsField = _mesh->getFamilyFieldAtLevel(meshDimRelToMax);
874 const MEDCoupling::DataArrayIdType * famIds = famIdsField->getDifferentValues();
875 const MEDCoupling::mcIdType * famID = famIds->begin(), *famIDEnd = famIds->end();
876 for (; famID < famIDEnd; ++famID)
878 if (!(*famID)) continue; // "FAMILLE_ZERO"
879 std::string famName = _mesh->getFamilyNameGivenId(*famID);
880 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> cellIds = _mesh->getFamilyArr( meshDimRelToMax, famName);
881 const MEDCoupling::mcIdType * cellIdsIt = cellIds->begin(), *cellIDEnd = cellIds->end();
882 for(; cellIdsIt< cellIDEnd; ++cellIdsIt)
884 INTERP_KERNEL::NormalizedCellType type = umesh0->getTypeOfCell(*cellIdsIt); //TODO
885 std::map<INTERP_KERNEL::NormalizedCellType, std::map <int, MeshFormatCell> >::iterator itCellMap = _typeToIdCellToCell.find(type);
886 if (itCellMap == _typeToIdCellToCell.end()) continue;
889 std::map <int, MeshFormatCell>::iterator itCell = itCellMap->second.find((int)*cellIdsIt);
890 if (itCell == itCellMap->second.end()) continue;
891 else itCell->second._famId = (int)*famID;
901 void MeshFormatWriter::writeCells()
904 std::map < INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >::iterator typeCellMapIt = _typeToIdCellToCell.begin();
905 for (; typeCellMapIt!= _typeToIdCellToCell.end(); ++typeCellMapIt)
907 std::map<int, MeshFormatCell>::iterator cellMapIt = typeCellMapIt->second.begin();
908 switch (typeCellMapIt->first)
910 case INTERP_KERNEL::NORM_SEG2 :
913 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfEdges, (int)typeCellMapIt->second.size());
915 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
917 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
918 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfEdges, conn[0], conn[1], std::abs(cellMapIt->second._famId) );
922 case INTERP_KERNEL::NORM_SEG3 :
925 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfEdges, (int)typeCellMapIt->second.size());
926 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
928 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
929 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfEdges, conn[0], conn[1], std::abs(cellMapIt->second._famId) );
931 cellMapIt = typeCellMapIt->second.begin();
933 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtEdges, (int)typeCellMapIt->second.size());
935 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
937 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
938 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtEdges, cellMapIt->first+1, 1, conn[2] );
942 case INTERP_KERNEL::NORM_TRI3 :
945 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfTriangles, (int)typeCellMapIt->second.size());
947 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
949 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
950 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfTriangles, conn[0], conn[1], conn[2], std::abs(cellMapIt->second._famId) );
954 case INTERP_KERNEL::NORM_TRI6 :
957 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfTriangles, (int)typeCellMapIt->second.size());
958 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
960 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
961 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfTriangles, conn[0], conn[1], conn[2], std::abs(cellMapIt->second._famId) );
964 cellMapIt = typeCellMapIt->second.begin();
965 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtTriangles, (int)typeCellMapIt->second.size());
967 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
969 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
970 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtTriangles, cellMapIt->first+1, 3, conn[3], conn[4], conn[5] );
974 case INTERP_KERNEL::NORM_QUAD4 :
977 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfQuadrilaterals, (int)typeCellMapIt->second.size());
979 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
981 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
982 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfQuadrilaterals, conn[0], conn[1], conn[2], conn[3], std::abs(cellMapIt->second._famId) );
986 case INTERP_KERNEL::NORM_QUAD8 :
989 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfQuadrilaterals, (int)typeCellMapIt->second.size());
990 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
992 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
993 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfQuadrilaterals, conn[0], conn[1], conn[2], conn[3], std::abs(cellMapIt->second._famId) );
995 cellMapIt = typeCellMapIt->second.begin();
996 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtQuadrilaterals, (int)typeCellMapIt->second.size());
998 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1000 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1001 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtQuadrilaterals, cellMapIt->first+1, 4, conn[4], conn[5],
1006 case INTERP_KERNEL::NORM_QUAD9 :
1009 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfQuadrilaterals, (int)typeCellMapIt->second.size());
1010 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1012 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1013 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfQuadrilaterals, conn[0], conn[1], conn[2], conn[3], std::abs(cellMapIt->second._famId) );
1015 cellMapIt = typeCellMapIt->second.begin();
1016 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtQuadrilaterals, (int)typeCellMapIt->second.size());
1018 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1020 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1021 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtQuadrilaterals,cellMapIt->first+1, 5, conn[4], conn[5],
1022 conn[6], conn[7], conn[8] );
1026 case INTERP_KERNEL::NORM_TETRA4 :
1029 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfTetrahedra, (int)typeCellMapIt->second.size());
1031 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1033 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1034 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfTetrahedra, conn[0], conn[2], conn[1], conn[3], std::abs(cellMapIt->second._famId) );
1038 case INTERP_KERNEL::NORM_TETRA10 :
1041 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtTetrahedra, (int)typeCellMapIt->second.size());
1042 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1044 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1045 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfTetrahedra, conn[0], conn[2], conn[1], conn[3], std::abs(cellMapIt->second._famId) );
1047 cellMapIt = typeCellMapIt->second.begin();
1048 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfTetrahedra, (int)typeCellMapIt->second.size());
1050 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1052 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1053 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtTetrahedra, cellMapIt->first+1, 6, conn[6], conn[5],
1054 conn[4], conn[7], conn[8], conn[9] );
1058 case INTERP_KERNEL::NORM_PYRA5 :
1061 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfPyramids, (int)typeCellMapIt->second.size());
1063 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1065 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1066 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfPyramids, conn[3], conn[2], conn[1], conn[0], conn[4], std::abs(cellMapIt->second._famId) );
1071 case INTERP_KERNEL::NORM_HEXA8 :
1074 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfHexahedra, (int)typeCellMapIt->second.size());
1076 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1078 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1079 _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) );
1084 case INTERP_KERNEL::NORM_HEXA20 :
1087 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfHexahedra, (int)typeCellMapIt->second.size());
1088 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1090 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1091 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfHexahedra, conn[0], conn[3], conn[2], conn[1],
1092 conn[4], conn[7], conn[6], conn[5], std::abs(cellMapIt->second._famId) );
1094 cellMapIt = typeCellMapIt->second.begin();
1095 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtHexahedra, (int)typeCellMapIt->second.size());
1097 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1099 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1100 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtHexahedra, cellMapIt->first+1, 12, conn[11], conn[10], conn[9],
1101 conn[8], conn[15], conn[14], conn[13], conn[12], conn[16], conn[19], conn[18], conn[17] );
1105 case INTERP_KERNEL::NORM_HEXA27 :
1108 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfHexahedra, (int)typeCellMapIt->second.size());
1109 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1111 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1112 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtHexahedra, conn[0], conn[3], conn[2], conn[1],
1113 conn[4], conn[7], conn[6], conn[5], std::abs(cellMapIt->second._famId) );
1115 cellMapIt = typeCellMapIt->second.begin();
1116 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtHexahedra, (int)typeCellMapIt->second.size());
1118 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1120 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1121 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtHexahedra, cellMapIt->first+1, 19, conn[11], conn[10], conn[9],
1122 conn[8], conn[15], conn[14], conn[13], conn[12], conn[16], conn[19], conn[18], conn[17],
1123 conn[20], conn[24], conn[23], conn[22], conn[21], conn[25], conn[26], std::abs(cellMapIt->second._famId) );
1127 case INTERP_KERNEL::NORM_PENTA6 :
1130 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfPrisms, (int)typeCellMapIt->second.size());
1132 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1134 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1135 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfPrisms, conn[0], conn[2], conn[1], conn[3], conn[5], conn[4], std::abs(cellMapIt->second._famId) );