1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
24 // File : SMESH_MEDMesh_i.cxx
27 #include "SMESH_MEDMesh_i.hxx"
28 #include "SMESH_Gen_i.hxx"
29 #include "SMESH_Mesh_i.hxx"
31 #include "SMESHDS_Mesh.hxx"
32 #include "SMESHDS_SubMesh.hxx"
34 #include "SMESH_MEDSupport_i.hxx"
35 #include "SMESH_MEDFamily_i.hxx"
38 #include <TopExp_Explorer.hxx>
40 #include <TopoDS_Iterator.hxx>
41 #include <TopoDS_Compound.hxx>
42 #include <TopoDS_CompSolid.hxx>
43 #include <TopoDS_Solid.hxx>
44 #include <TopoDS_Shell.hxx>
45 #include <TopoDS_Face.hxx>
46 #include <TopoDS_Wire.hxx>
47 #include <TopoDS_Edge.hxx>
48 #include <TopoDS_Vertex.hxx>
49 #include <TopoDS_Shape.hxx>
50 #include <TopTools_MapOfShape.hxx>
52 #include <utilities.h>
53 #include <Utils_CorbaException.hxx>
55 #include <Utils_ORB_INIT.hxx>
56 #include <Utils_SINGLETON.hxx>
57 #include <Utils_ExceptHandlers.hxx>
58 #include <SALOMEDS_wrap.hxx>
67 //=============================================================================
71 //=============================================================================
72 // PN Est-ce un const ?
73 SMESH_MEDMesh_i::SMESH_MEDMesh_i()
75 BEGIN_OF("Default Constructor SMESH_MEDMesh_i");
76 END_OF("Default Constructor SMESH_MEDMesh_i");
79 //=============================================================================
83 //=============================================================================
84 SMESH_MEDMesh_i::~SMESH_MEDMesh_i()
88 //=============================================================================
92 //=============================================================================
93 SMESH_MEDMesh_i::SMESH_MEDMesh_i(::SMESH_Mesh_i * m_i):_meshId(""),
100 BEGIN_OF("Constructor SMESH_MEDMesh_i");
103 _meshDS = _mesh_i->GetImpl().GetMeshDS();
105 END_OF("Constructor SMESH_MEDMesh_i");
108 //=============================================================================
110 * CORBA: Accessor for Name
112 //=============================================================================
113 char *SMESH_MEDMesh_i::getName() throw(SALOME::SALOME_Exception)
116 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
117 SALOME::INTERNAL_ERROR);
121 SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen();
122 SALOMEDS::Study_var study = gen->GetCurrentStudy();
123 SALOMEDS::SObject_wrap meshSO = gen->ObjectToSObject( study, _mesh_i->_this());
124 if ( meshSO->_is_nil() )
125 return CORBA::string_dup("toto");
127 CORBA::String_var name = meshSO->GetName();
129 return CORBA::string_dup( name.in() );
133 MESSAGE("Exception en accedant au nom");
134 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
135 SALOME::INTERNAL_ERROR);
140 //=============================================================================
142 * CORBA: Accessor for corbaindex cuisine interne
144 //=============================================================================
145 CORBA::Long SMESH_MEDMesh_i::getCorbaIndex()throw(SALOME::SALOME_Exception)
147 MESSAGE("Non Implemente");
148 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
151 //=============================================================================
153 * CORBA: Accessor for Space Dimension
155 //=============================================================================
156 CORBA::Long SMESH_MEDMesh_i::getSpaceDimension()throw(SALOME::SALOME_Exception)
158 // PN : Il semblerait que la dimension soit fixee a 3
160 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
161 SALOME::INTERNAL_ERROR);
165 //=============================================================================
167 * CORBA: Accessor for Mesh Dimension
169 //=============================================================================
170 CORBA::Long SMESH_MEDMesh_i::getMeshDimension()throw(SALOME::SALOME_Exception)
173 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
174 SALOME::INTERNAL_ERROR);
175 // PN : Il semblerait que la dimension soit fixee a 3
177 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
178 SALOME::INTERNAL_ERROR);
181 //=============================================================================
183 * CORBA: Accessor for the boolean _isAGrid
185 //=============================================================================
186 CORBA::Boolean SMESH_MEDMesh_i::getIsAGrid() throw (SALOME::SALOME_Exception)
188 MESSAGE("!!!!!! NOT YET IMPLEMENTED !!!!!!");
190 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
194 //=============================================================================
196 * CORBA: Accessor for the connectivities, to see if they exist
198 //=============================================================================
200 SMESH_MEDMesh_i::existConnectivity(SALOME_MED::medConnectivity connectivityType,
201 SALOME_MED::medEntityMesh entity)
202 throw (SALOME::SALOME_Exception)
204 MESSAGE("!!!!!! IMPLEMENTED BUT ONLY PARTIALLY !!!!!!");
210 //=============================================================================
212 * CORBA: Accessor for Coordinate
214 //=============================================================================
215 CORBA::Double SMESH_MEDMesh_i::getCoordinate(CORBA::Long Number, CORBA::Long Axis)
216 throw (SALOME::SALOME_Exception)
218 MESSAGE("!!!!!! NOT YET IMPLEMENTED !!!!");
220 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
224 //=============================================================================
226 * CORBA: Accessor for Coordinates System
228 //=============================================================================
229 char *SMESH_MEDMesh_i::getCoordinatesSystem() throw(SALOME::SALOME_Exception)
232 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
233 SALOME::INTERNAL_ERROR);
234 // PN : En dur. Non encore prevu
237 string systcoo = "CARTESIEN";
238 return CORBA::string_dup(systcoo.c_str());
242 MESSAGE("Exception en accedant au maillage");
243 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
244 SALOME::INTERNAL_ERROR);
248 //=============================================================================
250 * CORBA: Accessor for Coordinates
252 //=============================================================================
253 SALOME_TYPES::ListOfDouble * SMESH_MEDMesh_i::getCoordinates
254 (SALOME_MED::medModeSwitch typeSwitch) throw(SALOME::SALOME_Exception)
257 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
258 SALOME::INTERNAL_ERROR);
259 SALOME_TYPES::ListOfDouble_var myseq = new SALOME_TYPES::ListOfDouble;
263 int spaceDimension = 3;
264 int nbNodes = _meshDS->NbNodes();
266 myseq->length(nbNodes * spaceDimension);
269 SMDS_NodeIteratorPtr itNodes=_meshDS->nodesIterator();
270 while(itNodes->more())
272 const SMDS_MeshNode* node = itNodes->next();
274 if (typeSwitch == SALOME_MED::MED_FULL_INTERLACE)
276 myseq[i * 3] = node->X();
277 myseq[i * 3 + 1] = node->Y();
278 myseq[i * 3 + 2] = node->Z();
279 SCRUTE(myseq[i * 3]);
280 SCRUTE(myseq[i * 3 + 1]);
281 SCRUTE(myseq[i * 3 + 2]);
285 ASSERT(typeSwitch == SALOME_MED::MED_NO_INTERLACE);
286 myseq[i] = node->X();
287 myseq[i + nbNodes] = node->Y();
288 myseq[i + (nbNodes * 2)] = node->Z();
290 SCRUTE(myseq[i + nbNodes]);
291 SCRUTE(myseq[i + (nbNodes * 2)]);
298 MESSAGE("Exception en accedant aux coordonnees");
299 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
300 SALOME::INTERNAL_ERROR);
302 return myseq._retn();
305 //=============================================================================
307 * CORBA: Accessor for Coordinates Names
309 //=============================================================================
310 SALOME_TYPES::ListOfString *
311 SMESH_MEDMesh_i::getCoordinatesNames()throw(SALOME::SALOME_Exception)
314 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
315 SALOME::INTERNAL_ERROR);
316 SALOME_TYPES::ListOfString_var myseq = new SALOME_TYPES::ListOfString;
320 int spaceDimension = 3;
321 myseq->length(spaceDimension);
322 myseq[0] = CORBA::string_dup("x");
323 myseq[1] = CORBA::string_dup("y");
324 myseq[2] = CORBA::string_dup("z");
328 MESSAGE("Exception en accedant aux noms des coordonnees");
329 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
330 SALOME::INTERNAL_ERROR);
332 return myseq._retn();
336 //=============================================================================
338 * CORBA: Accessor for Coordinates Units
340 //=============================================================================
341 SALOME_TYPES::ListOfString *
342 SMESH_MEDMesh_i::getCoordinatesUnits()throw(SALOME::SALOME_Exception)
345 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
346 SALOME::INTERNAL_ERROR);
347 SALOME_TYPES::ListOfString_var myseq = new SALOME_TYPES::ListOfString;
351 int spaceDimension = 3;
352 myseq->length(spaceDimension);
353 myseq[0] = CORBA::string_dup("m");
354 myseq[1] = CORBA::string_dup("m");
355 myseq[2] = CORBA::string_dup("m");
359 MESSAGE("Exception en accedant aux unites des coordonnees");
360 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
361 SALOME::INTERNAL_ERROR);
363 return myseq._retn();
366 //=============================================================================
368 * CORBA: Accessor for Number of Nodes
370 //=============================================================================
371 CORBA::Long SMESH_MEDMesh_i::getNumberOfNodes()throw(SALOME::SALOME_Exception)
374 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
375 SALOME::INTERNAL_ERROR);
378 return _meshDS->NbNodes();
382 MESSAGE("Exception en accedant au nombre de noeuds");
383 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
384 SALOME::INTERNAL_ERROR);
388 //=============================================================================
390 * CORBA: Accessor for number of Types
392 //=============================================================================
393 CORBA::Long SMESH_MEDMesh_i::getNumberOfTypes(SALOME_MED::medEntityMesh entity)
394 throw(SALOME::SALOME_Exception)
397 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
398 SALOME::INTERNAL_ERROR);
404 if (_mapNbTypes.find(entity) != _mapNbTypes.end())
405 retour = _mapNbTypes[entity];
410 MESSAGE("Exception en accedant au nombre de Types");
411 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
412 SALOME::INTERNAL_ERROR);
416 //=============================================================================
418 * CORBA: Accessor for existing geometry element types
419 * Not implemented for MED_ALL_ENTITIES
421 //=============================================================================
422 SALOME_MED::medGeometryElement_array *
423 SMESH_MEDMesh_i::getTypes(SALOME_MED::medEntityMesh entity) throw(SALOME::
427 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
428 SALOME::INTERNAL_ERROR);
429 if (entity == SALOME_MED::MED_ALL_ENTITIES)
430 THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ENTITIES",
434 SALOME_MED::medGeometryElement_array_var myseq =
435 new SALOME_MED::medGeometryElement_array;
438 if (_mapNbTypes.find(entity) == _mapNbTypes.end())
439 THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh",
441 int nbTypes = _mapNbTypes[entity];
443 myseq->length(nbTypes);
445 if (_mapIndToVectTypes.find(entity) == _mapIndToVectTypes.end())
446 THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh",
447 SALOME::INTERNAL_ERROR);
449 int index = _mapIndToVectTypes[entity];
450 ASSERT(_TypesId[index].size() != 0);
452 vector < SALOME_MED::medGeometryElement >::iterator it;
453 for (it = _TypesId[index].begin(); it != _TypesId[index].end(); it++)
460 MESSAGE("Exception en accedant aux differents types");
461 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
462 SALOME::INTERNAL_ERROR);
464 return myseq._retn();
467 //=============================================================================
469 * CORBA: Returns number of elements of type medGeometryElement
470 * Not implemented for MED_ALL_ELEMENTS
471 * implemented for MED_ALL_ENTITIES
473 * Dans cette implementation, il n est pas prevu de tenir compte du entity
474 * qui ne doit pas pouvoir avoir deux valeurs differentes pour un geomElement
476 //=============================================================================
477 CORBA::Long SMESH_MEDMesh_i::getNumberOfElements(SALOME_MED::
478 medEntityMesh entity,
479 SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
482 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
483 SALOME::INTERNAL_ERROR);
484 if (geomElement == SALOME_MED::MED_ALL_ELEMENTS)
485 THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ELEMENTS",
493 if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end())
495 int index = _mapIndToSeqElts[geomElement];
497 retour = _seq_elemId[index]->length();
503 MESSAGE("Exception en accedant au nombre d élements");
504 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
505 SALOME::INTERNAL_ERROR);
509 //=============================================================================
511 * CORBA: Accessor for connectivities
513 //=============================================================================
514 SALOME_TYPES::ListOfLong *
515 SMESH_MEDMesh_i::getConnectivity(SALOME_MED::medConnectivity mode,
516 SALOME_MED::medEntityMesh entity,
517 SALOME_MED::medGeometryElement geomElement)
518 throw(SALOME::SALOME_Exception)
521 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
522 SALOME::INTERNAL_ERROR);
523 if (mode != SALOME_MED::MED_NODAL)
524 THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
525 /*if (typeSwitch == SALOME_MED::MED_NO_INTERLACE)
526 THROW_SALOME_CORBA_EXCEPTION("Not Yet Implemented", SALOME::BAD_PARAM);*/
530 // Faut-il renvoyer un pointeur vide ???
531 if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end())
532 THROW_SALOME_CORBA_EXCEPTION("No Such Element in the mesh",
535 int index = _mapIndToSeqElts[geomElement];
537 return _seq_elemId[index]._retn();
540 //=============================================================================
542 * CORBA: Accessor for connectivities
544 //=============================================================================
545 SALOME_TYPES::ListOfLong *
546 SMESH_MEDMesh_i::getConnectivityIndex(SALOME_MED::medConnectivity mode,
547 SALOME_MED::medEntityMesh entity)
548 throw(SALOME::SALOME_Exception)
550 MESSAGE("Pas Implemente dans SMESH");
551 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
555 //=============================================================================
557 * CORBA: Find an element corresponding to the given connectivity
559 //=============================================================================
561 SMESH_MEDMesh_i::getElementNumber(SALOME_MED::medConnectivity mode,
562 SALOME_MED::medEntityMesh entity,
563 SALOME_MED::medGeometryElement type,
564 const SALOME_TYPES::ListOfLong & connectivity)
565 throw(SALOME::SALOME_Exception)
567 const char *LOC = "getElementNumber ";
568 MESSAGE(LOC << "Pas Implemente dans SMESH");
569 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
573 //=============================================================================
575 * CORBA: Accessor for Ascendant connectivities
576 * not implemented for MED_ALL_ENTITIES and MED_MAILLE
578 //=============================================================================
579 SALOME_TYPES::ListOfLong *
580 SMESH_MEDMesh_i::getReverseConnectivity(SALOME_MED::
581 medConnectivity mode) throw(SALOME::SALOME_Exception)
583 MESSAGE("Pas Implemente dans SMESH");
584 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
588 //=============================================================================
590 * CORBA: Accessor for connectivities
592 //=============================================================================
593 SALOME_TYPES::ListOfLong *
594 SMESH_MEDMesh_i::getReverseConnectivityIndex(SALOME_MED::
595 medConnectivity mode) throw(SALOME::SALOME_Exception)
597 MESSAGE("Pas Implemente dans SMESH");
598 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
602 //=============================================================================
604 * CORBA: Returns number of families within the mesh
606 //=============================================================================
607 CORBA::Long SMESH_MEDMesh_i::getNumberOfFamilies(SALOME_MED::
608 medEntityMesh entity) throw(SALOME::SALOME_Exception)
610 if (_creeFamily == false)
613 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
614 SALOME::INTERNAL_ERROR);
615 return _families.size();
618 //=============================================================================
620 * CORBA: Returns number of groups within the mesh
622 //=============================================================================
623 CORBA::Long SMESH_MEDMesh_i::getNumberOfGroups(SALOME_MED::medEntityMesh entity)
624 throw(SALOME::SALOME_Exception)
627 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
628 SALOME::INTERNAL_ERROR);
629 MESSAGE(" Pas d implementation des groupes dans SMESH");
633 //=============================================================================
635 * CORBA: Returns references for families within the mesh
637 //=============================================================================
638 SALOME_MED::Family_array *
639 SMESH_MEDMesh_i::getFamilies(SALOME_MED::
640 medEntityMesh entity) throw(SALOME::SALOME_Exception)
642 if (_creeFamily == false)
645 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
646 SALOME::INTERNAL_ERROR);
647 SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array;
648 int nbfam = _families.size();
649 myseq->length(nbfam);
651 vector < SALOME_MED::FAMILY_ptr >::iterator it;
652 for (it = _families.begin(); it != _families.end(); it++)
656 return myseq._retn();
659 //=============================================================================
661 * CORBA: Returns references for family i within the mesh
663 //=============================================================================
664 SALOME_MED::FAMILY_ptr SMESH_MEDMesh_i::getFamily(SALOME_MED::
665 medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception)
667 if (_creeFamily == false)
670 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
671 SALOME::INTERNAL_ERROR);
673 SCRUTE(_families[i]->getName());
674 MESSAGE(" SMESH_MEDMesh_i::getFamily " << i) return _families[i];
677 //=============================================================================
679 * CORBA: Returns references for groups within the mesh
681 //=============================================================================
682 SALOME_MED::Group_array *
683 SMESH_MEDMesh_i::getGroups(SALOME_MED::medEntityMesh entity) throw(SALOME::
687 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
688 SALOME::INTERNAL_ERROR);
689 MESSAGE(" Pas d implementation des groupes dans SMESH");
690 THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
693 //=============================================================================
695 * CORBA: Returns references for group i within the mesh
697 //=============================================================================
698 SALOME_MED::GROUP_ptr SMESH_MEDMesh_i::getGroup(SALOME_MED::
699 medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception)
702 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
703 SALOME::INTERNAL_ERROR);
704 MESSAGE(" Pas d implementation des groupes dans SMESH");
705 THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
707 //=============================================================================
709 * CORBA: Returns references for the global numbering index
711 //=============================================================================
712 SALOME_TYPES::ListOfLong*
713 SMESH_MEDMesh_i::getGlobalNumberingIndex(SALOME_MED::medEntityMesh entity)
714 throw (SALOME::SALOME_Exception)
716 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
718 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
722 //=============================================================================
724 * CORBA: Returns references for the support of boundary elements of type
727 //=============================================================================
728 SALOME_MED::SUPPORT_ptr
729 SMESH_MEDMesh_i::getBoundaryElements(SALOME_MED::medEntityMesh entity)
730 throw (SALOME::SALOME_Exception)
732 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
734 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
738 //=============================================================================
740 * CORBA: Method return a reference on a support define on all the element of
743 //=============================================================================
744 SALOME_MED::SUPPORT_ptr
745 SMESH_MEDMesh_i::getSupportOnAll(SALOME_MED::medEntityMesh entity)
746 throw (SALOME::SALOME_Exception)
748 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
750 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
754 //=============================================================================
756 * CORBA: Returns references for the support of the skin of the support
759 //=============================================================================
760 SALOME_MED::SUPPORT_ptr
761 SMESH_MEDMesh_i::getSkin(SALOME_MED::SUPPORT_ptr mySupport3D)
762 throw (SALOME::SALOME_Exception)
764 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
766 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
770 //=============================================================================
774 //=============================================================================
775 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getVolume(SALOME_MED::
776 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
778 MESSAGE("Pas Implemente dans SMESH");
779 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
783 //=============================================================================
787 //=============================================================================
788 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getArea(SALOME_MED::
789 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
791 MESSAGE("Pas Implemente dans SMESH");
792 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
796 //=============================================================================
800 //=============================================================================
801 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getLength(SALOME_MED::
802 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
804 MESSAGE("Pas Implemente dans SMESH");
805 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
809 //=============================================================================
813 //=============================================================================
814 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNormal(SALOME_MED::
815 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
817 MESSAGE("Pas Implemente dans SMESH");
818 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
822 //=============================================================================
826 //=============================================================================
827 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getBarycenter(SALOME_MED::
828 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
830 MESSAGE("Pas Implemente dans SMESH");
831 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
835 //=============================================================================
839 //=============================================================================
840 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNeighbourhood(SALOME_MED::
841 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
843 MESSAGE("Non Implemente");
844 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
848 //=============================================================================
850 * CORBA: add the Mesh in the StudyManager
853 //=============================================================================
854 void SMESH_MEDMesh_i::addInStudy(SALOMEDS::Study_ptr myStudy,
855 SALOME_MED::GMESH_ptr myIor) throw(SALOME::SALOME_Exception)
857 BEGIN_OF("MED_Mesh_i::addInStudy");
860 MESSAGE("Mesh already in Study");
861 THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study", SALOME::BAD_PARAM);
863 END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
866 //=============================================================================
868 * CORBA: write mesh in a med file
870 //=============================================================================
871 void SMESH_MEDMesh_i::write(CORBA::Long i, const char *driverMeshName)
872 throw(SALOME::SALOME_Exception)
874 MESSAGE("Non Implemente");
875 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
878 //=============================================================================
880 * CORBA: read mesh in a med file
882 //=============================================================================
883 void SMESH_MEDMesh_i::read(CORBA::Long i) throw(SALOME::SALOME_Exception)
885 MESSAGE("Non Implemente");
886 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
889 //=============================================================================
891 * CORBA : release driver
893 //=============================================================================
894 void SMESH_MEDMesh_i::rmDriver(CORBA::Long i) throw(SALOME::SALOME_Exception)
896 MESSAGE("Non Implemente");
897 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
900 //=============================================================================
902 * CORBA : attach driver
904 //=============================================================================
905 CORBA::Long SMESH_MEDMesh_i::addDriver(SALOME_MED::medDriverTypes driverType,
906 const char *fileName, const char *meshName) throw(SALOME::SALOME_Exception)
908 MESSAGE("Non Implemente");
909 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
913 //=============================================================================
915 * Calcule le Nb d'elements par entite geometrique
917 //=============================================================================
918 void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception)
924 _mapNbTypes[SALOME_MED::MED_NODE] = 1;
925 // On compte les aretes MED_SEG2 ou MED_SEG3
926 // On range les elements dans les vecteurs correspondants
928 _mapIndToSeqElts[SALOME_MED::MED_SEG2] = _indexElts++;
929 _mapIndToSeqElts[SALOME_MED::MED_SEG3] = _indexElts++;
930 _mapIndToVectTypes[SALOME_MED::MED_EDGE] = _indexEnts++;
934 SALOME_MED::medGeometryElement medElement;
936 SMDS_EdgeIteratorPtr itEdges=_meshDS->edgesIterator();
937 while(itEdges->more())
939 const SMDS_MeshEdge* elem = itEdges->next();
940 int nb_of_nodes = elem->NbNodes();
946 medElement = SALOME_MED::MED_SEG2;
950 _TypesId[SALOME_MED::MED_EDGE].
951 push_back(SALOME_MED::MED_SEG2);
957 medElement = SALOME_MED::MED_SEG3;
961 _TypesId[SALOME_MED::MED_EDGE].
962 push_back(SALOME_MED::MED_SEG3);
967 int index = _mapIndToSeqElts[medElement];
969 // Traitement de l arete
971 int longueur = _seq_elemId[index]->length();
972 _seq_elemId[index]->length(longueur + nb_of_nodes);
974 SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
976 for(int k=0; itn->more(); k++)
977 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
980 _mapNbTypes[SALOME_MED::MED_EDGE] = trouveSeg2 + trouveSeg3;
982 // On compte les faces MED_TRIA3, MED_HEXA8, MED_TRIA6
983 // On range les elements dans les vecteurs correspondants
988 _mapIndToSeqElts[SALOME_MED::MED_TRIA3] = _indexElts++;
989 _mapIndToSeqElts[SALOME_MED::MED_TRIA6] = _indexElts++;
990 _mapIndToSeqElts[SALOME_MED::MED_QUAD4] = _indexElts++;
991 _mapIndToVectTypes[SALOME_MED::MED_FACE] = _indexEnts++;
993 SMDS_FaceIteratorPtr itFaces=_meshDS->facesIterator();
994 while(itFaces->more())
996 const SMDS_MeshFace * elem = itFaces->next();
997 int nb_of_nodes = elem->NbNodes();
1003 medElement = SALOME_MED::MED_TRIA3;
1004 if (trouveTria3 == 0)
1007 _TypesId[SALOME_MED::MED_FACE].
1008 push_back(SALOME_MED::MED_TRIA3);
1014 medElement = SALOME_MED::MED_QUAD4;
1015 if (trouveQuad4 == 0)
1018 _TypesId[SALOME_MED::MED_FACE].
1019 push_back(SALOME_MED::MED_QUAD4);
1025 medElement = SALOME_MED::MED_TRIA6;
1026 if (trouveTria6 == 0)
1029 _TypesId[SALOME_MED::MED_FACE].
1030 push_back(SALOME_MED::MED_TRIA6);
1035 int index = _mapIndToSeqElts[medElement];
1038 // Traitement de la face
1039 // Attention La numérotation des noeuds Med commence a 1
1041 int longueur = _seq_elemId[index]->length();
1042 _seq_elemId[index]->length(longueur + nb_of_nodes);
1044 SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
1046 for(int k=0; itn->more(); k++)
1047 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
1050 _mapNbTypes[SALOME_MED::MED_FACE] =
1051 trouveTria3 + trouveTria6 + trouveQuad4;
1053 _mapIndToSeqElts[SALOME_MED::MED_HEXA8] = _indexElts++;
1054 _mapIndToVectTypes[SALOME_MED::MED_CELL] = _indexEnts++;
1055 int index = _mapIndToSeqElts[medElement];
1057 int trouveHexa8 = 0;
1059 SMDS_VolumeIteratorPtr itVolumes=_meshDS->volumesIterator();
1060 while(itVolumes->more())
1062 const SMDS_MeshVolume * elem = itVolumes->next();
1064 int nb_of_nodes = elem->NbNodes();
1065 medElement = SALOME_MED::MED_HEXA8;
1066 ASSERT(nb_of_nodes == 8);
1068 if (trouveHexa8 == 0)
1071 _TypesId[SALOME_MED::MED_CELL].push_back(SALOME_MED::MED_HEXA8);
1073 // Traitement de la maille
1074 int longueur = _seq_elemId[index]->length();
1075 _seq_elemId[index]->length(longueur + nb_of_nodes);
1077 SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
1078 for(int k=0; itn->more(); k++)
1079 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
1082 _mapNbTypes[SALOME_MED::MED_CELL] = trouveHexa8;
1083 _mapNbTypes[SALOME_MED::MED_ALL_ENTITIES]
1085 trouveHexa8 + trouveTria3 + trouveTria6 + trouveQuad4 + trouveSeg2 +
1090 //=============================================================================
1092 * Creation des familles
1094 //=============================================================================
1095 void SMESH_MEDMesh_i::createFamilies() throw(SALOME::SALOME_Exception)
1097 Unexpect aCatch(SALOME_SalomeException);
1098 string famDes = ("Je ne sais pas");
1099 string famName0 = "Famille_";
1103 if (_creeFamily == false)
1106 //SMESH_subMesh_i *subMeshServant;
1108 map < int, SMESH_subMesh_i * >::iterator it;
1109 for (it = _mesh_i->_mapSubMesh_i.begin();
1110 it != _mesh_i->_mapSubMesh_i.end(); it++)
1112 SMESH_subMesh_i *submesh_i = (*it).second;
1113 int famIdent = (*it).first;
1115 ASSERT(famIdent < 999999999);
1116 sprintf(numero, "%d\n", famIdent);
1117 famName = famName0 + numero;
1119 SMESH_MEDFamily_i *famservant =
1120 new SMESH_MEDFamily_i(famIdent, submesh_i,
1121 famName, famDes, SALOME_MED::MED_NODE);
1123 SALOME_MED::FAMILY_ptr famille = SALOME_MED::FAMILY::_nil();
1124 POA_SALOME_MED::FAMILY* servantbase = dynamic_cast<POA_SALOME_MED::FAMILY*>(famservant);
1126 famille = SALOME_MED::FAMILY::_narrow( servantbase->_this() );
1128 SALOME_MED::FAMILY_ptr famille =
1129 SALOME_MED::FAMILY::_narrow( famservant->POA_SALOME_MED::FAMILY::_this() );
1131 _families.push_back(famille);
1135 //=============================================================================
1137 * Gives informations of the considered mesh.
1139 //=============================================================================
1140 SALOME_MED::GMESH::meshInfos * SMESH_MEDMesh_i::getMeshGlobal()
1141 throw (SALOME::SALOME_Exception)
1143 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1145 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1150 //================================================================================
1152 * \brief Converts this GMESH into MESH
1154 //================================================================================
1156 SALOME_MED::MESH_ptr SMESH_MEDMesh_i::convertInMESH() throw (SALOME::SALOME_Exception)
1158 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1160 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1165 //=============================================================================
1167 * Gives informations on coordinates of the considered mesh.
1169 //=============================================================================
1170 SALOME_MED::GMESH::coordinateInfos * SMESH_MEDMesh_i::getCoordGlobal()
1171 throw (SALOME::SALOME_Exception)
1173 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1175 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1179 //=============================================================================
1181 * Gives informations on connectivities of the considered mesh for the entity
1184 //=============================================================================
1185 SALOME_MED::MESH::connectivityInfos *
1186 SMESH_MEDMesh_i::getConnectGlobal(SALOME_MED::medEntityMesh entity)
1187 throw (SALOME::SALOME_Exception)
1189 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1191 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1195 //=============================================================================
1197 * Gives the type of the element number of entity entity
1199 //=============================================================================
1200 SALOME_MED::medGeometryElement
1201 SMESH_MEDMesh_i::getElementType(SALOME_MED::medEntityMesh entity,
1203 throw (SALOME::SALOME_Exception)
1205 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1207 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1209 return (SALOME_MED::medGeometryElement) 0;