1 // Copyright (C) 2021 CEA/DEN, EDF R&D
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);
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;
481 |*| extract the upper triangular matrix of fullTensor
482 |*| if _dim == 2 fill symTensor with values at index 0, 1 & 3 of fullTensor
485 |*| if _dim == 3 fill symTensor with values at index 0, 1, 2, 4, 5 & 8 of fullTensor
490 void MeshFormatWriter::extractSymetricTensor(double fullTensor[], double*& symTensor)
492 symTensor = new double[_dim*(_dim+1)/2];
493 for (int ii =0; ii<_dim; ii++)
494 for (int jj =ii; jj<_dim; jj++)
496 int kk = _dim*(_dim-1)/2- (_dim-ii)*(_dim-ii-1)/2+jj;
497 symTensor[kk] = fullTensor[ii+jj*_dim];
500 int MeshFormatWriter::getGmfSolKwd(const int nbComp, const int dim)
502 if (nbComp== 1) return GmfSca;
503 else if( dim == nbComp) return GmfVec;
504 else if (dim*(dim+1)/2 == nbComp || dim*dim == nbComp ) return GmfSymMat;
505 //~else if (dim*dim == nbComp) return GmfMat; // Not valid in mg-adapt if not sym
508 bool MeshFormatWriter::checkFileName()
513 bool MeshFormatWriter::checkFieldFileName()
520 std::string MeshFormatWriter::getMeshFileName() const
522 return _meshFileName;
526 std::vector<std::string> MeshFormatWriter::getFieldFileNames() const
528 return _fieldFileNames;
531 MeshFormat::Status MeshFormatWriter::addMessage(const std::string& msg,
532 const bool isFatal/*=false*/)
535 _myErrorMessages.clear(); // warnings are useless if a fatal error encounters
537 _myErrorMessages.push_back( msg );
541 std::cout << msg << std::endl;
543 return ( _myStatus = isFatal ? MeshFormat::DRS_FAIL : MeshFormat::DRS_WARN_SKIP_ELEM );
547 void MeshFormatWriter::forward_shift(std::vector<MEDCoupling::mcIdType> &conn)
549 std::vector<MEDCoupling::mcIdType>::iterator it = conn.begin();
550 for (; it != conn.end(); ++it) *it = *it+1;
554 void MeshFormatWriter::getNodes(MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh0)
556 MEDCoupling::mcIdType nbNodes = 0;
557 nbNodes = umesh0->getNumberOfNodes();
561 MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> coordArray = umesh0->getCoordinatesAndOwner();
562 double* coordPrt = coordArray->getPointer();
563 _writer.GmfSetKwd( _myCurrentFileId, MeshFormat::GmfVertices, nbNodes );
565 int j = (int)nbNodes;
572 std::copy(coordPrt, coordPrt+_dim, xyz);
574 MeshFormatNode e(xyz[0], xyz[1], xyz[2], idNode);
575 _idNodeToNode.insert(std::pair <int, MeshFormatNode> (idNode, e));
582 std::map <int, MeshFormatNode>::iterator itNode = _idNodeToNode.begin();
583 for (; itNode!= _idNodeToNode.end(); ++itNode)
584 _dim == 3? _writer.GmfSetLin( _myCurrentFileId, MeshFormat::GmfVertices, itNode->second.xyz[0],
585 itNode->second.xyz[1], itNode->second.xyz[2], std::abs(itNode->second._famId) ) :
586 _writer.GmfSetLin( _myCurrentFileId, MeshFormat::GmfVertices, itNode->second.xyz[0],
587 itNode->second.xyz[1], std::abs(itNode->second._famId) );
591 void MeshFormatWriter::getNSEG2(MEDCoupling::mcIdType nbEdgesNSEG2, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh1)
594 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh1->giveCellsWithType(INTERP_KERNEL::NORM_SEG2);
595 std::map<int, MeshFormatCell> idCellToCell;
596 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
598 std::vector<MEDCoupling::mcIdType> conn;
599 umesh1->getNodeIdsOfCell(*it, conn) ;
602 MeshFormatCell e(INTERP_KERNEL::NORM_SEG2, (int)*it);
604 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
606 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_SEG2, idCellToCell) );
610 void MeshFormatWriter::getNSEG3( MEDCoupling::mcIdType nbEdgesNSEG3, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh1)
614 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh1->giveCellsWithType(INTERP_KERNEL::NORM_SEG3);
615 std::map<int, MeshFormatCell> idCellToCell;
616 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
619 std::vector<MEDCoupling::mcIdType> conn;
620 umesh1->getNodeIdsOfCell(*it, conn) ;
622 MeshFormatCell e(INTERP_KERNEL::NORM_SEG3, (int)*it);
624 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
626 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_SEG3, idCellToCell) );
630 void MeshFormatWriter::getTRI3( MEDCoupling::mcIdType nbTRI3, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
633 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_TRI3);
634 std::map<int, MeshFormatCell> idCellToCell;
635 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
637 std::vector<MEDCoupling::mcIdType> conn;
638 umesh2->getNodeIdsOfCell(*it, conn) ;
640 MeshFormatCell e(INTERP_KERNEL::NORM_TRI3, (int)*it);
642 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
644 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_TRI3, idCellToCell) );
648 void MeshFormatWriter::getTRI6( MEDCoupling::mcIdType nbTRI6, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
651 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_TRI6);
652 std::map<int, MeshFormatCell> idCellToCell;
653 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
655 std::vector<MEDCoupling::mcIdType> conn;
656 umesh2->getNodeIdsOfCell(*it, conn) ;
658 MeshFormatCell e(INTERP_KERNEL::NORM_TRI6, (int)*it);
660 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
663 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_TRI6, idCellToCell) );
666 void MeshFormatWriter::getQUAD4( MEDCoupling::mcIdType nbQUAD4, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
669 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_QUAD4);
670 std::map<int, MeshFormatCell> idCellToCell;
671 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
673 std::vector<MEDCoupling::mcIdType> conn;
674 umesh2->getNodeIdsOfCell(*it, conn) ;
676 MeshFormatCell e(INTERP_KERNEL::NORM_QUAD4, (int)*it);
678 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
680 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_QUAD4, idCellToCell) );
683 void MeshFormatWriter::getQUAD8(MEDCoupling::mcIdType nbQUAD8, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
686 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_QUAD8);
687 std::map<int, MeshFormatCell> idCellToCell;
688 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
690 std::vector<MEDCoupling::mcIdType> conn;
691 umesh2->getNodeIdsOfCell(*it, conn) ;
693 MeshFormatCell e(INTERP_KERNEL::NORM_QUAD8, (int)*it);
695 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
697 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_QUAD8, idCellToCell) );
700 void MeshFormatWriter::getQUAD9(MEDCoupling::mcIdType nbQUAD9, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh2)
703 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh2->giveCellsWithType(INTERP_KERNEL::NORM_QUAD9);
704 std::map<int, MeshFormatCell> idCellToCell;
705 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
707 std::vector<MEDCoupling::mcIdType> conn;
708 umesh2->getNodeIdsOfCell(*it, conn) ;
710 MeshFormatCell e(INTERP_KERNEL::NORM_QUAD9, (int)*it);
712 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
715 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_QUAD9, idCellToCell) );
718 void MeshFormatWriter::getTETRA4(MEDCoupling::mcIdType nbTETRA4, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
721 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_TETRA4);
722 std::map<int, MeshFormatCell> idCellToCell;
723 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
725 std::vector<MEDCoupling::mcIdType> conn;
726 umesh3->getNodeIdsOfCell(*it, conn) ;
728 MeshFormatCell e(INTERP_KERNEL::NORM_TETRA4, (int)*it);
730 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
733 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_TETRA4, idCellToCell) );
736 void MeshFormatWriter::getTETRA10(MEDCoupling::mcIdType nbTETRA10, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
739 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_TETRA10);
740 std::map<int, MeshFormatCell> idCellToCell;
741 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
743 std::vector<MEDCoupling::mcIdType> conn;
744 umesh3->getNodeIdsOfCell(*it, conn) ;
746 MeshFormatCell e(INTERP_KERNEL::NORM_TETRA10, (int)*it);
748 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
750 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_TETRA10, idCellToCell) );
753 void MeshFormatWriter::getPYRA5(MEDCoupling::mcIdType nbPYRA5, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
756 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_PYRA5);
757 std::map<int, MeshFormatCell> idCellToCell;
758 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
760 std::vector<MEDCoupling::mcIdType> conn;
761 umesh3->getNodeIdsOfCell(*it, conn) ;
763 MeshFormatCell e(INTERP_KERNEL::NORM_PYRA5, (int)*it);
765 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
767 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_PYRA5, idCellToCell) );
770 void MeshFormatWriter::getHEXA8(MEDCoupling::mcIdType nbHEXA8, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
773 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_HEXA8);
774 std::map<int, MeshFormatCell> idCellToCell;
775 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
777 std::vector<MEDCoupling::mcIdType> conn;
778 umesh3->getNodeIdsOfCell(*it, conn) ;
780 MeshFormatCell e(INTERP_KERNEL::NORM_HEXA8, (int)*it);
782 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
784 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_HEXA8, idCellToCell) );
786 void MeshFormatWriter::getHEXA20(MEDCoupling::mcIdType nbHEXA20, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
789 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_HEXA20);
790 std::map<int, MeshFormatCell> idCellToCell;
791 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
793 std::vector<MEDCoupling::mcIdType> conn;
794 umesh3->getNodeIdsOfCell(*it, conn) ;
796 MeshFormatCell e(INTERP_KERNEL::NORM_HEXA20, (int)*it);
798 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
800 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_HEXA20, idCellToCell) );
802 void MeshFormatWriter::getHEXA27(MEDCoupling::mcIdType nbHEXA27, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
805 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_HEXA27);
806 std::map<int, MeshFormatCell> idCellToCell;
807 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
809 std::vector<MEDCoupling::mcIdType> conn;
810 umesh3->getNodeIdsOfCell(*it, conn) ;
812 MeshFormatCell e(INTERP_KERNEL::NORM_HEXA27, (int)*it);
814 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
816 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_HEXA27, idCellToCell) );
819 void MeshFormatWriter::getPENTA6(MEDCoupling::mcIdType nbPENTA6, MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh3)
822 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> elementId = umesh3->giveCellsWithType(INTERP_KERNEL::NORM_PENTA6);
823 std::map<int, MeshFormatCell> idCellToCell;
824 for ( const mcIdType *it=elementId->begin(); it!=elementId->end(); it++ )
826 std::vector<MEDCoupling::mcIdType> conn;
827 umesh3->getNodeIdsOfCell(*it, conn) ;
829 MeshFormatCell e(INTERP_KERNEL::NORM_PENTA6, (int)*it);
831 idCellToCell.insert(std::pair <int, MeshFormatCell> (*it, e));
833 _typeToIdCellToCell.insert(std::pair <INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >(INTERP_KERNEL::NORM_PENTA6, idCellToCell) );
837 void MeshFormatWriter::linkFamilyToNodes()
840 std::map<std::string,mcIdType> famInfos = _mesh->getFamilyInfo();
841 std::map<std::string,mcIdType>::const_iterator famIt = famInfos.begin();
842 for (; famIt != famInfos.end(); ++famIt)
844 if(!famIt->second) continue; //FAMILLE_ZERO
845 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> nodeIds = _mesh->getNodeFamilyArr(famIt->first);
846 const MEDCoupling::mcIdType * nodeIdsIt = nodeIds->begin(), * famIDEnd = nodeIds->end();
847 for(; nodeIdsIt< famIDEnd; ++nodeIdsIt) {
849 std::map <int, MeshFormatNode>::iterator itNode = _idNodeToNode.find((int)*nodeIdsIt);
850 if (itNode == _idNodeToNode.end()) continue;
851 else itNode->second._famId =(int) famIt->second;
860 void MeshFormatWriter::linkFamilyToCells()
863 std::vector<int> levs = _mesh->getNonEmptyLevels();
864 for (size_t iDim = 0; iDim < levs.size(); iDim++ )
866 int meshDimRelToMax = levs[iDim];
867 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingMesh > mesh = _mesh->getMeshAtLevel( meshDimRelToMax);
868 MEDCoupling::MCAuto< MEDCoupling::MEDCouplingUMesh > umesh0 = mesh->buildUnstructured();
869 const MEDCoupling::DataArrayIdType * famIds = _mesh->getFamilyFieldAtLevel(meshDimRelToMax);
870 const MEDCoupling::mcIdType * famID = famIds->begin(), *famIDEnd = famIds->end();
871 for (; famID < famIDEnd; ++famID)
873 if (!(*famID)) continue; // "FAMILLE_ZERO"
874 std::string famName = _mesh->getFamilyNameGivenId(*famID);
875 MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> cellIds = _mesh->getFamilyArr( meshDimRelToMax, famName);
876 const MEDCoupling::mcIdType * cellIdsIt = cellIds->begin(), *cellIDEnd = cellIds->end();
877 for(; cellIdsIt< cellIDEnd; ++cellIdsIt)
879 INTERP_KERNEL::NormalizedCellType type = umesh0->getTypeOfCell(*cellIdsIt); //TODO
880 std::map<INTERP_KERNEL::NormalizedCellType, std::map <int, MeshFormatCell> >::iterator itCellMap = _typeToIdCellToCell.find(type);
881 if (itCellMap == _typeToIdCellToCell.end()) continue;
884 std::map <int, MeshFormatCell>::iterator itCell = itCellMap->second.find((int)*cellIdsIt);
885 if (itCell == itCellMap->second.end()) continue;
886 else itCell->second._famId = (int)*famID;
896 void MeshFormatWriter::writeCells()
899 std::map < INTERP_KERNEL::NormalizedCellType, std::map<int, MeshFormatCell> >::iterator typeCellMapIt = _typeToIdCellToCell.begin();
900 for (; typeCellMapIt!= _typeToIdCellToCell.end(); ++typeCellMapIt)
902 std::map<int, MeshFormatCell>::iterator cellMapIt = typeCellMapIt->second.begin();
903 switch (typeCellMapIt->first)
905 case INTERP_KERNEL::NORM_SEG2 :
908 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfEdges, (int)typeCellMapIt->second.size());
910 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
912 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
913 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfEdges, conn[0], conn[1], std::abs(cellMapIt->second._famId) );
917 case INTERP_KERNEL::NORM_SEG3 :
920 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfEdges, (int)typeCellMapIt->second.size());
921 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
923 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
924 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfEdges, conn[0], conn[1], std::abs(cellMapIt->second._famId) );
926 cellMapIt = typeCellMapIt->second.begin();
928 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtEdges, (int)typeCellMapIt->second.size());
930 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
932 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
933 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtEdges, cellMapIt->first+1, 1, conn[2] );
937 case INTERP_KERNEL::NORM_TRI3 :
940 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfTriangles, (int)typeCellMapIt->second.size());
942 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
944 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
945 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfTriangles, conn[0], conn[1], conn[2], std::abs(cellMapIt->second._famId) );
949 case INTERP_KERNEL::NORM_TRI6 :
952 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfTriangles, (int)typeCellMapIt->second.size());
953 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
955 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
956 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfTriangles, conn[0], conn[1], conn[2], std::abs(cellMapIt->second._famId) );
959 cellMapIt = typeCellMapIt->second.begin();
960 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtTriangles, (int)typeCellMapIt->second.size());
962 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
964 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
965 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtTriangles, cellMapIt->first+1, 3, conn[3], conn[4], conn[5] );
969 case INTERP_KERNEL::NORM_QUAD4 :
972 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfQuadrilaterals, (int)typeCellMapIt->second.size());
974 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
976 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
977 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfQuadrilaterals, conn[0], conn[1], conn[2], conn[3], std::abs(cellMapIt->second._famId) );
981 case INTERP_KERNEL::NORM_QUAD8 :
984 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfQuadrilaterals, (int)typeCellMapIt->second.size());
985 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
987 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
988 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfQuadrilaterals, conn[0], conn[1], conn[2], conn[3], std::abs(cellMapIt->second._famId) );
990 cellMapIt = typeCellMapIt->second.begin();
991 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtQuadrilaterals, (int)typeCellMapIt->second.size());
993 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
995 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
996 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtQuadrilaterals, cellMapIt->first+1, 4, conn[4], conn[5],
1001 case INTERP_KERNEL::NORM_QUAD9 :
1004 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfQuadrilaterals, (int)typeCellMapIt->second.size());
1005 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1007 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1008 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfQuadrilaterals, conn[0], conn[1], conn[2], conn[3], std::abs(cellMapIt->second._famId) );
1010 cellMapIt = typeCellMapIt->second.begin();
1011 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtQuadrilaterals, (int)typeCellMapIt->second.size());
1013 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1015 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1016 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtQuadrilaterals,cellMapIt->first+1, 5, conn[4], conn[5],
1017 conn[6], conn[7], conn[8] );
1021 case INTERP_KERNEL::NORM_TETRA4 :
1024 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfTetrahedra, (int)typeCellMapIt->second.size());
1026 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1028 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1029 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfTetrahedra, conn[0], conn[2], conn[1], conn[3], std::abs(cellMapIt->second._famId) );
1033 case INTERP_KERNEL::NORM_TETRA10 :
1036 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtTetrahedra, (int)typeCellMapIt->second.size());
1037 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1039 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1040 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfTetrahedra, conn[0], conn[2], conn[1], conn[3], std::abs(cellMapIt->second._famId) );
1042 cellMapIt = typeCellMapIt->second.begin();
1043 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfTetrahedra, (int)typeCellMapIt->second.size());
1045 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1047 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1048 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtTetrahedra, cellMapIt->first+1, 6, conn[6], conn[5],
1049 conn[4], conn[7], conn[8], conn[9] );
1053 case INTERP_KERNEL::NORM_PYRA5 :
1056 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfPyramids, (int)typeCellMapIt->second.size());
1058 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1060 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1061 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfPyramids, conn[3], conn[2], conn[1], conn[0], conn[4], std::abs(cellMapIt->second._famId) );
1066 case INTERP_KERNEL::NORM_HEXA8 :
1069 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfHexahedra, (int)typeCellMapIt->second.size());
1071 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1073 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1074 _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) );
1079 case INTERP_KERNEL::NORM_HEXA20 :
1082 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfHexahedra, (int)typeCellMapIt->second.size());
1083 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1085 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1086 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfHexahedra, conn[0], conn[3], conn[2], conn[1],
1087 conn[4], conn[7], conn[6], conn[5], std::abs(cellMapIt->second._famId) );
1089 cellMapIt = typeCellMapIt->second.begin();
1090 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtHexahedra, (int)typeCellMapIt->second.size());
1092 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1094 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1095 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtHexahedra, cellMapIt->first+1, 12, conn[11], conn[10], conn[9],
1096 conn[8], conn[15], conn[14], conn[13], conn[12], conn[16], conn[19], conn[18], conn[17] );
1100 case INTERP_KERNEL::NORM_HEXA27 :
1103 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfHexahedra, (int)typeCellMapIt->second.size());
1104 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1106 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1107 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtHexahedra, conn[0], conn[3], conn[2], conn[1],
1108 conn[4], conn[7], conn[6], conn[5], std::abs(cellMapIt->second._famId) );
1110 cellMapIt = typeCellMapIt->second.begin();
1111 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtHexahedra, (int)typeCellMapIt->second.size());
1113 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1115 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1116 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfExtraVerticesAtHexahedra, cellMapIt->first+1, 19, conn[11], conn[10], conn[9],
1117 conn[8], conn[15], conn[14], conn[13], conn[12], conn[16], conn[19], conn[18], conn[17],
1118 conn[20], conn[24], conn[23], conn[22], conn[21], conn[25], conn[26], std::abs(cellMapIt->second._famId) );
1122 case INTERP_KERNEL::NORM_PENTA6 :
1125 _writer.GmfSetKwd(_myCurrentFileId, MeshFormat::GmfPrisms, (int)typeCellMapIt->second.size());
1127 for (; cellMapIt != typeCellMapIt->second.end(); ++cellMapIt)
1129 std::vector<MEDCoupling::mcIdType> conn = cellMapIt->second.conn;
1130 _writer.GmfSetLin(_myCurrentFileId, MeshFormat::GmfPrisms, conn[0], conn[2], conn[1], conn[3], conn[5], conn[4], std::abs(cellMapIt->second._famId) );