1 // Copyright (C) 2007-2013 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 MESSAGE("getElementNumber(): Pas Implemente dans SMESH");
568 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
572 //=============================================================================
574 * CORBA: Accessor for Ascendant connectivities
575 * not implemented for MED_ALL_ENTITIES and MED_MAILLE
577 //=============================================================================
578 SALOME_TYPES::ListOfLong *
579 SMESH_MEDMesh_i::getReverseConnectivity(SALOME_MED::
580 medConnectivity mode) throw(SALOME::SALOME_Exception)
582 MESSAGE("Pas Implemente dans SMESH");
583 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
587 //=============================================================================
589 * CORBA: Accessor for connectivities
591 //=============================================================================
592 SALOME_TYPES::ListOfLong *
593 SMESH_MEDMesh_i::getReverseConnectivityIndex(SALOME_MED::
594 medConnectivity mode) throw(SALOME::SALOME_Exception)
596 MESSAGE("Pas Implemente dans SMESH");
597 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
601 //=============================================================================
603 * CORBA: Returns number of families within the mesh
605 //=============================================================================
606 CORBA::Long SMESH_MEDMesh_i::getNumberOfFamilies(SALOME_MED::
607 medEntityMesh entity) throw(SALOME::SALOME_Exception)
609 if (_creeFamily == false)
612 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
613 SALOME::INTERNAL_ERROR);
614 return _families.size();
617 //=============================================================================
619 * CORBA: Returns number of groups within the mesh
621 //=============================================================================
622 CORBA::Long SMESH_MEDMesh_i::getNumberOfGroups(SALOME_MED::medEntityMesh entity)
623 throw(SALOME::SALOME_Exception)
626 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
627 SALOME::INTERNAL_ERROR);
628 MESSAGE(" Pas d implementation des groupes dans SMESH");
632 //=============================================================================
634 * CORBA: Returns references for families within the mesh
636 //=============================================================================
637 SALOME_MED::Family_array *
638 SMESH_MEDMesh_i::getFamilies(SALOME_MED::
639 medEntityMesh entity) throw(SALOME::SALOME_Exception)
641 if (_creeFamily == false)
644 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
645 SALOME::INTERNAL_ERROR);
646 SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array;
647 int nbfam = _families.size();
648 myseq->length(nbfam);
650 vector < SALOME_MED::FAMILY_ptr >::iterator it;
651 for (it = _families.begin(); it != _families.end(); it++)
655 return myseq._retn();
658 //=============================================================================
660 * CORBA: Returns references for family i within the mesh
662 //=============================================================================
663 SALOME_MED::FAMILY_ptr SMESH_MEDMesh_i::getFamily(SALOME_MED::
664 medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception)
666 if (_creeFamily == false)
669 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
670 SALOME::INTERNAL_ERROR);
672 SCRUTE(_families[i]->getName());
673 MESSAGE(" SMESH_MEDMesh_i::getFamily " << i) return _families[i];
676 //=============================================================================
678 * CORBA: Returns references for groups within the mesh
680 //=============================================================================
681 SALOME_MED::Group_array *
682 SMESH_MEDMesh_i::getGroups(SALOME_MED::medEntityMesh entity) throw(SALOME::
686 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
687 SALOME::INTERNAL_ERROR);
688 MESSAGE(" Pas d implementation des groupes dans SMESH");
689 THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
692 //=============================================================================
694 * CORBA: Returns references for group i within the mesh
696 //=============================================================================
697 SALOME_MED::GROUP_ptr SMESH_MEDMesh_i::getGroup(SALOME_MED::
698 medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception)
701 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
702 SALOME::INTERNAL_ERROR);
703 MESSAGE(" Pas d implementation des groupes dans SMESH");
704 THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
706 //=============================================================================
708 * CORBA: Returns references for the global numbering index
710 //=============================================================================
711 SALOME_TYPES::ListOfLong*
712 SMESH_MEDMesh_i::getGlobalNumberingIndex(SALOME_MED::medEntityMesh entity)
713 throw (SALOME::SALOME_Exception)
715 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
717 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
721 //=============================================================================
723 * CORBA: Returns references for the support of boundary elements of type
726 //=============================================================================
727 SALOME_MED::SUPPORT_ptr
728 SMESH_MEDMesh_i::getBoundaryElements(SALOME_MED::medEntityMesh entity)
729 throw (SALOME::SALOME_Exception)
731 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
733 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
737 //=============================================================================
739 * CORBA: Method return a reference on a support define on all the element of
742 //=============================================================================
743 SALOME_MED::SUPPORT_ptr
744 SMESH_MEDMesh_i::getSupportOnAll(SALOME_MED::medEntityMesh entity)
745 throw (SALOME::SALOME_Exception)
747 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
749 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
753 //=============================================================================
755 * CORBA: Returns references for the support of the skin of the support
758 //=============================================================================
759 SALOME_MED::SUPPORT_ptr
760 SMESH_MEDMesh_i::getSkin(SALOME_MED::SUPPORT_ptr mySupport3D)
761 throw (SALOME::SALOME_Exception)
763 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
765 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
769 //=============================================================================
773 //=============================================================================
774 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getVolume(SALOME_MED::
775 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
777 MESSAGE("Pas Implemente dans SMESH");
778 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
782 //=============================================================================
786 //=============================================================================
787 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getArea(SALOME_MED::
788 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
790 MESSAGE("Pas Implemente dans SMESH");
791 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
795 //=============================================================================
799 //=============================================================================
800 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getLength(SALOME_MED::
801 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
803 MESSAGE("Pas Implemente dans SMESH");
804 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
808 //=============================================================================
812 //=============================================================================
813 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNormal(SALOME_MED::
814 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
816 MESSAGE("Pas Implemente dans SMESH");
817 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
821 //=============================================================================
825 //=============================================================================
826 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getBarycenter(SALOME_MED::
827 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
829 MESSAGE("Pas Implemente dans SMESH");
830 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
834 //=============================================================================
838 //=============================================================================
839 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNeighbourhood(SALOME_MED::
840 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
842 MESSAGE("Non Implemente");
843 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
847 //=============================================================================
849 * CORBA: add the Mesh in the StudyManager
852 //=============================================================================
853 void SMESH_MEDMesh_i::addInStudy(SALOMEDS::Study_ptr myStudy,
854 SALOME_MED::GMESH_ptr myIor) throw(SALOME::SALOME_Exception)
856 BEGIN_OF("MED_Mesh_i::addInStudy");
859 MESSAGE("Mesh already in Study");
860 THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study", SALOME::BAD_PARAM);
862 END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
865 //=============================================================================
867 * CORBA: write mesh in a med file
869 //=============================================================================
870 void SMESH_MEDMesh_i::write(CORBA::Long i, const char *driverMeshName)
871 throw(SALOME::SALOME_Exception)
873 MESSAGE("Non Implemente");
874 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
877 //=============================================================================
879 * CORBA: read mesh in a med file
881 //=============================================================================
882 void SMESH_MEDMesh_i::read(CORBA::Long i) throw(SALOME::SALOME_Exception)
884 MESSAGE("Non Implemente");
885 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
888 //=============================================================================
890 * CORBA : release driver
892 //=============================================================================
893 void SMESH_MEDMesh_i::rmDriver(CORBA::Long i) throw(SALOME::SALOME_Exception)
895 MESSAGE("Non Implemente");
896 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
899 //=============================================================================
901 * CORBA : attach driver
903 //=============================================================================
904 CORBA::Long SMESH_MEDMesh_i::addDriver(SALOME_MED::medDriverTypes driverType,
905 const char *fileName, const char *meshName) throw(SALOME::SALOME_Exception)
907 MESSAGE("Non Implemente");
908 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
912 //=============================================================================
914 * Calcule le Nb d'elements par entite geometrique
916 //=============================================================================
917 void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception)
923 _mapNbTypes[SALOME_MED::MED_NODE] = 1;
924 // On compte les aretes MED_SEG2 ou MED_SEG3
925 // On range les elements dans les vecteurs correspondants
927 _mapIndToSeqElts[SALOME_MED::MED_SEG2] = _indexElts++;
928 _mapIndToSeqElts[SALOME_MED::MED_SEG3] = _indexElts++;
929 _mapIndToVectTypes[SALOME_MED::MED_EDGE] = _indexEnts++;
933 SALOME_MED::medGeometryElement medElement;
935 SMDS_EdgeIteratorPtr itEdges=_meshDS->edgesIterator();
936 while(itEdges->more())
938 const SMDS_MeshEdge* elem = itEdges->next();
939 int nb_of_nodes = elem->NbNodes();
945 medElement = SALOME_MED::MED_SEG2;
949 _TypesId[SALOME_MED::MED_EDGE].
950 push_back(SALOME_MED::MED_SEG2);
956 medElement = SALOME_MED::MED_SEG3;
960 _TypesId[SALOME_MED::MED_EDGE].
961 push_back(SALOME_MED::MED_SEG3);
966 int index = _mapIndToSeqElts[medElement];
968 // Traitement de l arete
970 int longueur = _seq_elemId[index]->length();
971 _seq_elemId[index]->length(longueur + nb_of_nodes);
973 SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
975 for(int k=0; itn->more(); k++)
976 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
979 _mapNbTypes[SALOME_MED::MED_EDGE] = trouveSeg2 + trouveSeg3;
981 // On compte les faces MED_TRIA3, MED_HEXA8, MED_TRIA6
982 // On range les elements dans les vecteurs correspondants
987 _mapIndToSeqElts[SALOME_MED::MED_TRIA3] = _indexElts++;
988 _mapIndToSeqElts[SALOME_MED::MED_TRIA6] = _indexElts++;
989 _mapIndToSeqElts[SALOME_MED::MED_QUAD4] = _indexElts++;
990 _mapIndToVectTypes[SALOME_MED::MED_FACE] = _indexEnts++;
992 SMDS_FaceIteratorPtr itFaces=_meshDS->facesIterator();
993 while(itFaces->more())
995 const SMDS_MeshFace * elem = itFaces->next();
996 int nb_of_nodes = elem->NbNodes();
1002 medElement = SALOME_MED::MED_TRIA3;
1003 if (trouveTria3 == 0)
1006 _TypesId[SALOME_MED::MED_FACE].
1007 push_back(SALOME_MED::MED_TRIA3);
1013 medElement = SALOME_MED::MED_QUAD4;
1014 if (trouveQuad4 == 0)
1017 _TypesId[SALOME_MED::MED_FACE].
1018 push_back(SALOME_MED::MED_QUAD4);
1024 medElement = SALOME_MED::MED_TRIA6;
1025 if (trouveTria6 == 0)
1028 _TypesId[SALOME_MED::MED_FACE].
1029 push_back(SALOME_MED::MED_TRIA6);
1034 int index = _mapIndToSeqElts[medElement];
1037 // Traitement de la face
1038 // Attention La numérotation des noeuds Med commence a 1
1040 int longueur = _seq_elemId[index]->length();
1041 _seq_elemId[index]->length(longueur + nb_of_nodes);
1043 SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
1045 for(int k=0; itn->more(); k++)
1046 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
1049 _mapNbTypes[SALOME_MED::MED_FACE] =
1050 trouveTria3 + trouveTria6 + trouveQuad4;
1052 _mapIndToSeqElts[SALOME_MED::MED_HEXA8] = _indexElts++;
1053 _mapIndToVectTypes[SALOME_MED::MED_CELL] = _indexEnts++;
1054 int index = _mapIndToSeqElts[medElement];
1056 int trouveHexa8 = 0;
1058 SMDS_VolumeIteratorPtr itVolumes=_meshDS->volumesIterator();
1059 while(itVolumes->more())
1061 const SMDS_MeshVolume * elem = itVolumes->next();
1063 int nb_of_nodes = elem->NbNodes();
1064 medElement = SALOME_MED::MED_HEXA8;
1065 ASSERT(nb_of_nodes == 8);
1067 if (trouveHexa8 == 0)
1070 _TypesId[SALOME_MED::MED_CELL].push_back(SALOME_MED::MED_HEXA8);
1072 // Traitement de la maille
1073 int longueur = _seq_elemId[index]->length();
1074 _seq_elemId[index]->length(longueur + nb_of_nodes);
1076 SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
1077 for(int k=0; itn->more(); k++)
1078 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
1081 _mapNbTypes[SALOME_MED::MED_CELL] = trouveHexa8;
1082 _mapNbTypes[SALOME_MED::MED_ALL_ENTITIES]
1084 trouveHexa8 + trouveTria3 + trouveTria6 + trouveQuad4 + trouveSeg2 +
1089 //=============================================================================
1091 * Creation des familles
1093 //=============================================================================
1094 void SMESH_MEDMesh_i::createFamilies() throw(SALOME::SALOME_Exception)
1096 Unexpect aCatch(SALOME_SalomeException);
1097 string famDes = ("Je ne sais pas");
1098 string famName0 = "Famille_";
1102 if (_creeFamily == false)
1105 //SMESH_subMesh_i *subMeshServant;
1107 map < int, SMESH_subMesh_i * >::iterator it;
1108 for (it = _mesh_i->_mapSubMesh_i.begin();
1109 it != _mesh_i->_mapSubMesh_i.end(); it++)
1111 SMESH_subMesh_i *submesh_i = (*it).second;
1112 int famIdent = (*it).first;
1114 ASSERT(famIdent < 999999999);
1115 sprintf(numero, "%d\n", famIdent);
1116 famName = famName0 + numero;
1118 SMESH_MEDFamily_i *famservant =
1119 new SMESH_MEDFamily_i(famIdent, submesh_i,
1120 famName, famDes, SALOME_MED::MED_NODE);
1122 SALOME_MED::FAMILY_ptr famille = SALOME_MED::FAMILY::_nil();
1123 POA_SALOME_MED::FAMILY* servantbase = dynamic_cast<POA_SALOME_MED::FAMILY*>(famservant);
1125 famille = SALOME_MED::FAMILY::_narrow( servantbase->_this() );
1127 SALOME_MED::FAMILY_ptr famille =
1128 SALOME_MED::FAMILY::_narrow( famservant->POA_SALOME_MED::FAMILY::_this() );
1130 _families.push_back(famille);
1134 //=============================================================================
1136 * Gives informations of the considered mesh.
1138 //=============================================================================
1139 SALOME_MED::GMESH::meshInfos * SMESH_MEDMesh_i::getMeshGlobal()
1140 throw (SALOME::SALOME_Exception)
1142 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1144 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1149 //================================================================================
1151 * \brief Converts this GMESH into MESH
1153 //================================================================================
1155 SALOME_MED::MESH_ptr SMESH_MEDMesh_i::convertInMESH() throw (SALOME::SALOME_Exception)
1157 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1159 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1164 //=============================================================================
1166 * Gives informations on coordinates of the considered mesh.
1168 //=============================================================================
1169 SALOME_MED::GMESH::coordinateInfos * SMESH_MEDMesh_i::getCoordGlobal()
1170 throw (SALOME::SALOME_Exception)
1172 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1174 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1178 //=============================================================================
1180 * Gives informations on connectivities of the considered mesh for the entity
1183 //=============================================================================
1184 SALOME_MED::MESH::connectivityInfos *
1185 SMESH_MEDMesh_i::getConnectGlobal(SALOME_MED::medEntityMesh entity)
1186 throw (SALOME::SALOME_Exception)
1188 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1190 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1194 //=============================================================================
1196 * Gives the type of the element number of entity entity
1198 //=============================================================================
1199 SALOME_MED::medGeometryElement
1200 SMESH_MEDMesh_i::getElementType(SALOME_MED::medEntityMesh entity,
1202 throw (SALOME::SALOME_Exception)
1204 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1206 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1208 return (SALOME_MED::medGeometryElement) 0;