1 // Copyright (C) 2007-2008 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
22 // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
23 // File : SMESH_MEDMesh_i.cxx
26 #include "SMESH_MEDMesh_i.hxx"
27 #include "SMESH_Mesh_i.hxx"
29 #include "SMESHDS_Mesh.hxx"
30 #include "SMESHDS_SubMesh.hxx"
33 #include <TopExp_Explorer.hxx>
35 #include <TopoDS_Iterator.hxx>
36 #include <TopoDS_Compound.hxx>
37 #include <TopoDS_CompSolid.hxx>
38 #include <TopoDS_Solid.hxx>
39 #include <TopoDS_Shell.hxx>
40 #include <TopoDS_Face.hxx>
41 #include <TopoDS_Wire.hxx>
42 #include <TopoDS_Edge.hxx>
43 #include <TopoDS_Vertex.hxx>
44 #include <TopoDS_Shape.hxx>
45 #include <TopTools_MapOfShape.hxx>
47 #include "utilities.h"
48 #include "Utils_CorbaException.hxx"
50 #include "SMESH_MEDSupport_i.hxx"
51 #include "SMESH_MEDFamily_i.hxx"
53 # include "Utils_ORB_INIT.hxx"
54 # include "Utils_SINGLETON.hxx"
55 # include "Utils_ExceptHandlers.hxx"
64 //=============================================================================
68 //=============================================================================
69 // PN Est-ce un const ?
70 SMESH_MEDMesh_i::SMESH_MEDMesh_i()
72 BEGIN_OF("Default Constructor SMESH_MEDMesh_i");
73 END_OF("Default Constructor SMESH_MEDMesh_i");
76 //=============================================================================
80 //=============================================================================
81 SMESH_MEDMesh_i::~SMESH_MEDMesh_i()
85 //=============================================================================
89 //=============================================================================
90 SMESH_MEDMesh_i::SMESH_MEDMesh_i(::SMESH_Mesh_i * m_i):_meshId(""),
97 BEGIN_OF("Constructor SMESH_MEDMesh_i");
100 _meshDS = _mesh_i->GetImpl().GetMeshDS();
102 END_OF("Constructor SMESH_MEDMesh_i");
105 //=============================================================================
107 * CORBA: Accessor for Name
109 //=============================================================================
110 char *SMESH_MEDMesh_i::getName() throw(SALOME::SALOME_Exception)
113 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
114 SALOME::INTERNAL_ERROR);
118 // A COMPLETER PAR LE NOM DU MAILLAGE
119 //return CORBA::string_dup(_mesh_i->getName().c_str());
120 return CORBA::string_dup("toto");
124 MESSAGE("Exception en accedant au nom");
125 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
126 SALOME::INTERNAL_ERROR);
130 //=============================================================================
132 * CORBA: Accessor for corbaindex cuisine interne
134 //=============================================================================
135 CORBA::Long SMESH_MEDMesh_i::getCorbaIndex()throw(SALOME::SALOME_Exception)
137 MESSAGE("Non Implemente");
138 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
141 //=============================================================================
143 * CORBA: Accessor for Space Dimension
145 //=============================================================================
146 CORBA::Long SMESH_MEDMesh_i::getSpaceDimension()throw(SALOME::SALOME_Exception)
148 // PN : Il semblerait que la dimension soit fixee a 3
150 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
151 SALOME::INTERNAL_ERROR);
155 //=============================================================================
157 * CORBA: Accessor for Mesh Dimension
159 //=============================================================================
160 CORBA::Long SMESH_MEDMesh_i::getMeshDimension()throw(SALOME::SALOME_Exception)
163 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
164 SALOME::INTERNAL_ERROR);
165 // PN : Il semblerait que la dimension soit fixee a 3
167 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
168 SALOME::INTERNAL_ERROR);
171 //=============================================================================
173 * CORBA: Accessor for the boolean _isAGrid
175 //=============================================================================
176 CORBA::Boolean SMESH_MEDMesh_i::getIsAGrid() throw (SALOME::SALOME_Exception)
178 MESSAGE("!!!!!! NOT YET IMPLEMENTED !!!!!!");
180 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
184 //=============================================================================
186 * CORBA: Accessor for the connectivities, to see if they exist
188 //=============================================================================
190 SMESH_MEDMesh_i::existConnectivity(SALOME_MED::medConnectivity connectivityType,
191 SALOME_MED::medEntityMesh entity)
192 throw (SALOME::SALOME_Exception)
194 MESSAGE("!!!!!! IMPLEMENTED BUT ONLY PARTIALLY !!!!!!");
200 //=============================================================================
202 * CORBA: Accessor for Coordinate
204 //=============================================================================
205 CORBA::Double SMESH_MEDMesh_i::getCoordinate(CORBA::Long Number, CORBA::Long Axis)
206 throw (SALOME::SALOME_Exception)
208 MESSAGE("!!!!!! NOT YET IMPLEMENTED !!!!");
210 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
214 //=============================================================================
216 * CORBA: Accessor for Coordinates System
218 //=============================================================================
219 char *SMESH_MEDMesh_i::getCoordinatesSystem() throw(SALOME::SALOME_Exception)
222 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
223 SALOME::INTERNAL_ERROR);
224 // PN : En dur. Non encore prevu
227 string systcoo = "CARTESIEN";
228 return CORBA::string_dup(systcoo.c_str());
232 MESSAGE("Exception en accedant au maillage");
233 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
234 SALOME::INTERNAL_ERROR);
238 //=============================================================================
240 * CORBA: Accessor for Coordinates
242 //=============================================================================
243 SALOME_MED::double_array * SMESH_MEDMesh_i::getCoordinates(
244 SALOME_MED::medModeSwitch typeSwitch) throw(SALOME::SALOME_Exception)
247 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
248 SALOME::INTERNAL_ERROR);
249 SALOME_MED::double_array_var myseq = new SALOME_MED::double_array;
253 int spaceDimension = 3;
254 int nbNodes = _meshDS->NbNodes();
256 myseq->length(nbNodes * spaceDimension);
259 SMDS_NodeIteratorPtr itNodes=_meshDS->nodesIterator();
260 while(itNodes->more())
262 const SMDS_MeshNode* node = itNodes->next();
264 if (typeSwitch == SALOME_MED::MED_FULL_INTERLACE)
266 myseq[i * 3] = node->X();
267 myseq[i * 3 + 1] = node->Y();
268 myseq[i * 3 + 2] = node->Z();
269 SCRUTE(myseq[i * 3]);
270 SCRUTE(myseq[i * 3 + 1]);
271 SCRUTE(myseq[i * 3 + 2]);
275 ASSERT(typeSwitch == SALOME_MED::MED_NO_INTERLACE);
276 myseq[i] = node->X();
277 myseq[i + nbNodes] = node->Y();
278 myseq[i + (nbNodes * 2)] = node->Z();
280 SCRUTE(myseq[i + nbNodes]);
281 SCRUTE(myseq[i + (nbNodes * 2)]);
288 MESSAGE("Exception en accedant aux coordonnees");
289 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
290 SALOME::INTERNAL_ERROR);
292 return myseq._retn();
295 //=============================================================================
297 * CORBA: Accessor for Coordinates Names
299 //=============================================================================
300 SALOME_MED::string_array *
301 SMESH_MEDMesh_i::getCoordinatesNames()throw(SALOME::SALOME_Exception)
304 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
305 SALOME::INTERNAL_ERROR);
306 SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
310 int spaceDimension = 3;
311 myseq->length(spaceDimension);
312 myseq[0] = CORBA::string_dup("x");
313 myseq[1] = CORBA::string_dup("y");
314 myseq[2] = CORBA::string_dup("z");
318 MESSAGE("Exception en accedant aux noms des coordonnees");
319 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
320 SALOME::INTERNAL_ERROR);
322 return myseq._retn();
326 //=============================================================================
328 * CORBA: Accessor for Coordinates Units
330 //=============================================================================
331 SALOME_MED::string_array *
332 SMESH_MEDMesh_i::getCoordinatesUnits()throw(SALOME::SALOME_Exception)
335 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
336 SALOME::INTERNAL_ERROR);
337 SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
341 int spaceDimension = 3;
342 myseq->length(spaceDimension);
343 myseq[0] = CORBA::string_dup("m");
344 myseq[1] = CORBA::string_dup("m");
345 myseq[2] = CORBA::string_dup("m");
349 MESSAGE("Exception en accedant aux unites des coordonnees");
350 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
351 SALOME::INTERNAL_ERROR);
353 return myseq._retn();
356 //=============================================================================
358 * CORBA: Accessor for Number of Nodes
360 //=============================================================================
361 CORBA::Long SMESH_MEDMesh_i::getNumberOfNodes()throw(SALOME::SALOME_Exception)
364 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
365 SALOME::INTERNAL_ERROR);
368 return _meshDS->NbNodes();
372 MESSAGE("Exception en accedant au nombre de noeuds");
373 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
374 SALOME::INTERNAL_ERROR);
378 //=============================================================================
380 * CORBA: Accessor for number of Types
382 //=============================================================================
383 CORBA::Long SMESH_MEDMesh_i::getNumberOfTypes(SALOME_MED::medEntityMesh entity)
384 throw(SALOME::SALOME_Exception)
387 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
388 SALOME::INTERNAL_ERROR);
394 if (_mapNbTypes.find(entity) != _mapNbTypes.end())
395 retour = _mapNbTypes[entity];
400 MESSAGE("Exception en accedant au nombre de Types");
401 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
402 SALOME::INTERNAL_ERROR);
406 //=============================================================================
408 * CORBA: Accessor for existing geometry element types
409 * Not implemented for MED_ALL_ENTITIES
411 //=============================================================================
412 SALOME_MED::medGeometryElement_array *
413 SMESH_MEDMesh_i::getTypes(SALOME_MED::medEntityMesh entity) throw(SALOME::
417 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
418 SALOME::INTERNAL_ERROR);
419 if (entity == SALOME_MED::MED_ALL_ENTITIES)
420 THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ENTITIES",
424 SALOME_MED::medGeometryElement_array_var myseq =
425 new SALOME_MED::medGeometryElement_array;
428 if (_mapNbTypes.find(entity) == _mapNbTypes.end())
429 THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh",
431 int nbTypes = _mapNbTypes[entity];
433 myseq->length(nbTypes);
435 if (_mapIndToVectTypes.find(entity) == _mapIndToVectTypes.end())
436 THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh",
437 SALOME::INTERNAL_ERROR);
439 int index = _mapIndToVectTypes[entity];
440 ASSERT(_TypesId[index].size() != 0);
442 vector < SALOME_MED::medGeometryElement >::iterator it;
443 for (it = _TypesId[index].begin(); it != _TypesId[index].end(); it++)
450 MESSAGE("Exception en accedant aux differents types");
451 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
452 SALOME::INTERNAL_ERROR);
454 return myseq._retn();
457 //=============================================================================
459 * CORBA: Returns number of elements of type medGeometryElement
460 * Not implemented for MED_ALL_ELEMENTS
461 * implemented for MED_ALL_ENTITIES
463 * Dans cette implementation, il n est pas prevu de tenir compte du entity
464 * qui ne doit pas pouvoir avoir deux valeurs differentes pour un geomElement
466 //=============================================================================
467 CORBA::Long SMESH_MEDMesh_i::getNumberOfElements(SALOME_MED::
468 medEntityMesh entity,
469 SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
472 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
473 SALOME::INTERNAL_ERROR);
474 if (geomElement == SALOME_MED::MED_ALL_ELEMENTS)
475 THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ELEMENTS",
483 if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end())
485 int index = _mapIndToSeqElts[geomElement];
487 retour = _seq_elemId[index]->length();
493 MESSAGE("Exception en accedant au nombre d élements");
494 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
495 SALOME::INTERNAL_ERROR);
499 //=============================================================================
501 * CORBA: Accessor for connectivities
503 //=============================================================================
504 SALOME_MED::long_array *
505 SMESH_MEDMesh_i::getConnectivity(SALOME_MED::medModeSwitch typeSwitch,
506 SALOME_MED::medConnectivity mode,
507 SALOME_MED::medEntityMesh entity,
508 SALOME_MED::medGeometryElement geomElement)
509 throw(SALOME::SALOME_Exception)
512 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
513 SALOME::INTERNAL_ERROR);
514 if (mode != SALOME_MED::MED_NODAL)
515 THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
516 if (typeSwitch == SALOME_MED::MED_NO_INTERLACE)
517 THROW_SALOME_CORBA_EXCEPTION("Not Yet Implemented", SALOME::BAD_PARAM);
521 // Faut-il renvoyer un pointeur vide ???
522 if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end())
523 THROW_SALOME_CORBA_EXCEPTION("No Such Element in the mesh",
526 int index = _mapIndToSeqElts[geomElement];
528 return _seq_elemId[index]._retn();
531 //=============================================================================
533 * CORBA: Accessor for connectivities
535 //=============================================================================
536 SALOME_MED::long_array *
537 SMESH_MEDMesh_i::getConnectivityIndex(SALOME_MED::medConnectivity mode,
538 SALOME_MED::medEntityMesh entity)
539 throw(SALOME::SALOME_Exception)
541 MESSAGE("Pas Implemente dans SMESH");
542 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
546 //=============================================================================
548 * CORBA: Find an element corresponding to the given connectivity
550 //=============================================================================
552 SMESH_MEDMesh_i::getElementNumber(SALOME_MED::medConnectivity mode,
553 SALOME_MED::medEntityMesh entity,
554 SALOME_MED::medGeometryElement type,
555 const SALOME_MED::long_array & connectivity)
556 throw(SALOME::SALOME_Exception)
558 const char *LOC = "getElementNumber ";
559 MESSAGE(LOC << "Pas Implemente dans SMESH");
560 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
564 //=============================================================================
566 * CORBA: Accessor for Ascendant connectivities
567 * not implemented for MED_ALL_ENTITIES and MED_MAILLE
569 //=============================================================================
570 SALOME_MED::long_array *
571 SMESH_MEDMesh_i::getReverseConnectivity(SALOME_MED::
572 medConnectivity mode) throw(SALOME::SALOME_Exception)
574 MESSAGE("Pas Implemente dans SMESH");
575 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
579 //=============================================================================
581 * CORBA: Accessor for connectivities
583 //=============================================================================
584 SALOME_MED::long_array *
585 SMESH_MEDMesh_i::getReverseConnectivityIndex(SALOME_MED::
586 medConnectivity mode) throw(SALOME::SALOME_Exception)
588 MESSAGE("Pas Implemente dans SMESH");
589 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
593 //=============================================================================
595 * CORBA: Returns number of families within the mesh
597 //=============================================================================
598 CORBA::Long SMESH_MEDMesh_i::getNumberOfFamilies(SALOME_MED::
599 medEntityMesh entity) throw(SALOME::SALOME_Exception)
601 if (_creeFamily == false)
604 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
605 SALOME::INTERNAL_ERROR);
606 return _families.size();
609 //=============================================================================
611 * CORBA: Returns number of groups within the mesh
613 //=============================================================================
614 CORBA::Long SMESH_MEDMesh_i::getNumberOfGroups(SALOME_MED::medEntityMesh entity)
615 throw(SALOME::SALOME_Exception)
618 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
619 SALOME::INTERNAL_ERROR);
620 MESSAGE(" Pas d implementation des groupes dans SMESH");
624 //=============================================================================
626 * CORBA: Returns references for families within the mesh
628 //=============================================================================
629 SALOME_MED::Family_array *
630 SMESH_MEDMesh_i::getFamilies(SALOME_MED::
631 medEntityMesh entity) throw(SALOME::SALOME_Exception)
633 if (_creeFamily == false)
636 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
637 SALOME::INTERNAL_ERROR);
638 SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array;
639 int nbfam = _families.size();
640 myseq->length(nbfam);
642 vector < SALOME_MED::FAMILY_ptr >::iterator it;
643 for (it = _families.begin(); it != _families.end(); it++)
647 return myseq._retn();
650 //=============================================================================
652 * CORBA: Returns references for family i within the mesh
654 //=============================================================================
655 SALOME_MED::FAMILY_ptr SMESH_MEDMesh_i::getFamily(SALOME_MED::
656 medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception)
658 if (_creeFamily == false)
661 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
662 SALOME::INTERNAL_ERROR);
664 SCRUTE(_families[i]->getName());
665 MESSAGE(" SMESH_MEDMesh_i::getFamily " << i) return _families[i];
668 //=============================================================================
670 * CORBA: Returns references for groups within the mesh
672 //=============================================================================
673 SALOME_MED::Group_array *
674 SMESH_MEDMesh_i::getGroups(SALOME_MED::medEntityMesh entity) throw(SALOME::
678 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
679 SALOME::INTERNAL_ERROR);
680 MESSAGE(" Pas d implementation des groupes dans SMESH");
681 THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
684 //=============================================================================
686 * CORBA: Returns references for group i within the mesh
688 //=============================================================================
689 SALOME_MED::GROUP_ptr SMESH_MEDMesh_i::getGroup(SALOME_MED::
690 medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception)
693 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
694 SALOME::INTERNAL_ERROR);
695 MESSAGE(" Pas d implementation des groupes dans SMESH");
696 THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
698 //=============================================================================
700 * CORBA: Returns references for the global numbering index
702 //=============================================================================
703 SALOME_MED::long_array*
704 SMESH_MEDMesh_i::getGlobalNumberingIndex(SALOME_MED::medEntityMesh entity)
705 throw (SALOME::SALOME_Exception)
707 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
709 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
713 //=============================================================================
715 * CORBA: Returns references for the support of boundary elements of type
718 //=============================================================================
719 SALOME_MED::SUPPORT_ptr
720 SMESH_MEDMesh_i::getBoundaryElements(SALOME_MED::medEntityMesh entity)
721 throw (SALOME::SALOME_Exception)
723 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
725 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
729 //=============================================================================
731 * CORBA: Method return a reference on a support define on all the element of
734 //=============================================================================
735 SALOME_MED::SUPPORT_ptr
736 SMESH_MEDMesh_i::getSupportOnAll(SALOME_MED::medEntityMesh entity)
737 throw (SALOME::SALOME_Exception)
739 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
741 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
746 //=============================================================================
748 * CORBA: Returns references for the support of the skin of the support
751 //=============================================================================
752 SALOME_MED::SUPPORT_ptr
753 SMESH_MEDMesh_i::getSkin(SALOME_MED::SUPPORT_ptr mySupport3D)
754 throw (SALOME::SALOME_Exception)
756 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
758 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
762 //=============================================================================
766 //=============================================================================
767 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getVolume(SALOME_MED::
768 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
770 MESSAGE("Pas Implemente dans SMESH");
771 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
775 //=============================================================================
779 //=============================================================================
780 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getArea(SALOME_MED::
781 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
783 MESSAGE("Pas Implemente dans SMESH");
784 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
788 //=============================================================================
792 //=============================================================================
793 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getLength(SALOME_MED::
794 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
796 MESSAGE("Pas Implemente dans SMESH");
797 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
801 //=============================================================================
805 //=============================================================================
806 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNormal(SALOME_MED::
807 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
809 MESSAGE("Pas Implemente dans SMESH");
810 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
814 //=============================================================================
818 //=============================================================================
819 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getBarycenter(SALOME_MED::
820 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
822 MESSAGE("Pas Implemente dans SMESH");
823 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
827 //=============================================================================
831 //=============================================================================
832 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNeighbourhood(SALOME_MED::
833 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
835 MESSAGE("Non Implemente");
836 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
840 //=============================================================================
842 * CORBA: add the Mesh in the StudyManager
845 //=============================================================================
846 void SMESH_MEDMesh_i::addInStudy(SALOMEDS::Study_ptr myStudy,
847 SALOME_MED::MESH_ptr myIor) throw(SALOME::SALOME_Exception)
849 BEGIN_OF("MED_Mesh_i::addInStudy");
852 MESSAGE("Mesh already in Study");
853 THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study",
858 * SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
860 * // Create SComponent labelled 'MED' if it doesn't already exit
861 * SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
862 * if ( CORBA::is_nil(medfather) )
864 * MESSAGE("Add Component MED");
865 * medfather = myBuilder->NewComponent("MED");
866 * //myBuilder->AddAttribute (medfather,SALOMEDS::Name,"MED");
867 * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
868 * myBuilder->FindOrCreateAttribute(medfather, "AttributeName"));
869 * aName->SetValue("MED");
871 * myBuilder->DefineComponentInstance(medfather,myIor);
875 * MESSAGE("Add a mesh Object under MED");
876 * myBuilder->NewCommand();
877 * SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfather);
879 * ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
880 * ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
881 * CORBA::ORB_var &orb = init(0,0);
882 * CORBA::String_var iorStr = orb->object_to_string(myIor);
883 * //myBuilder->AddAttribute(newObj,SALOMEDS::IOR,iorStr.in());
884 * SALOMEDS::AttributeIOR_var aIOR = SALOMEDS::AttributeIOR::_narrow(
885 * myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"));
886 * aIOR->SetValue(iorStr.c_str());
888 * //myBuilder->AddAttribute(newObj,SALOMEDS::Name,_mesh_i->getName().c_str());
889 * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
890 * myBuilder->FindOrCreateAttribute(newObj, "AttributeName"));
891 * aName->SetValue(_mesh_i->getName().c_str());
893 * _meshId = newObj->GetID();
894 * myBuilder->CommitCommand();
897 END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
900 //=============================================================================
902 * CORBA: write mesh in a med file
904 //=============================================================================
905 void SMESH_MEDMesh_i::write(CORBA::Long i, const char *driverMeshName)
906 throw(SALOME::SALOME_Exception)
908 MESSAGE("Non Implemente");
909 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
912 //=============================================================================
914 * CORBA: read mesh in a med file
916 //=============================================================================
917 void SMESH_MEDMesh_i::read(CORBA::Long i) throw(SALOME::SALOME_Exception)
919 MESSAGE("Non Implemente");
920 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
923 //=============================================================================
925 * CORBA : release driver
927 //=============================================================================
928 void SMESH_MEDMesh_i::rmDriver(CORBA::Long i) throw(SALOME::SALOME_Exception)
930 MESSAGE("Non Implemente");
931 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
934 //=============================================================================
936 * CORBA : attach driver
938 //=============================================================================
939 CORBA::Long SMESH_MEDMesh_i::addDriver(SALOME_MED::medDriverTypes driverType,
940 const char *fileName, const char *meshName) throw(SALOME::SALOME_Exception)
942 MESSAGE("Non Implemente");
943 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
947 //=============================================================================
949 * Calcule le Nb d'elements par entite geometrique
951 //=============================================================================
952 void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception)
958 _mapNbTypes[SALOME_MED::MED_NODE] = 1;
959 // On compte les aretes MED_SEG2 ou MED_SEG3
960 // On range les elements dans les vecteurs correspondants
962 _mapIndToSeqElts[SALOME_MED::MED_SEG2] = _indexElts++;
963 _mapIndToSeqElts[SALOME_MED::MED_SEG3] = _indexElts++;
964 _mapIndToVectTypes[SALOME_MED::MED_EDGE] = _indexEnts++;
968 SALOME_MED::medGeometryElement medElement;
970 SMDS_EdgeIteratorPtr itEdges=_meshDS->edgesIterator();
971 while(itEdges->more())
973 const SMDS_MeshEdge* elem = itEdges->next();
974 int nb_of_nodes = elem->NbNodes();
980 medElement = SALOME_MED::MED_SEG2;
984 _TypesId[SALOME_MED::MED_EDGE].
985 push_back(SALOME_MED::MED_SEG2);
991 medElement = SALOME_MED::MED_SEG3;
995 _TypesId[SALOME_MED::MED_EDGE].
996 push_back(SALOME_MED::MED_SEG3);
1001 int index = _mapIndToSeqElts[medElement];
1003 // Traitement de l arete
1005 int longueur = _seq_elemId[index]->length();
1006 _seq_elemId[index]->length(longueur + nb_of_nodes);
1008 SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
1010 for(int k=0; itn->more(); k++)
1011 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
1014 _mapNbTypes[SALOME_MED::MED_EDGE] = trouveSeg2 + trouveSeg3;
1016 // On compte les faces MED_TRIA3, MED_HEXA8, MED_TRIA6
1017 // On range les elements dans les vecteurs correspondants
1018 int trouveTria3 = 0;
1019 int trouveTria6 = 0;
1020 int trouveQuad4 = 0;
1022 _mapIndToSeqElts[SALOME_MED::MED_TRIA3] = _indexElts++;
1023 _mapIndToSeqElts[SALOME_MED::MED_TRIA6] = _indexElts++;
1024 _mapIndToSeqElts[SALOME_MED::MED_QUAD4] = _indexElts++;
1025 _mapIndToVectTypes[SALOME_MED::MED_FACE] = _indexEnts++;
1027 SMDS_FaceIteratorPtr itFaces=_meshDS->facesIterator();
1028 while(itFaces->more())
1030 const SMDS_MeshFace * elem = itFaces->next();
1031 int nb_of_nodes = elem->NbNodes();
1033 switch (nb_of_nodes)
1037 medElement = SALOME_MED::MED_TRIA3;
1038 if (trouveTria3 == 0)
1041 _TypesId[SALOME_MED::MED_FACE].
1042 push_back(SALOME_MED::MED_TRIA3);
1048 medElement = SALOME_MED::MED_QUAD4;
1049 if (trouveQuad4 == 0)
1052 _TypesId[SALOME_MED::MED_FACE].
1053 push_back(SALOME_MED::MED_QUAD4);
1059 medElement = SALOME_MED::MED_TRIA6;
1060 if (trouveTria6 == 0)
1063 _TypesId[SALOME_MED::MED_FACE].
1064 push_back(SALOME_MED::MED_TRIA6);
1069 int index = _mapIndToSeqElts[medElement];
1072 // Traitement de la face
1073 // Attention La numérotation des noeuds Med commence a 1
1075 int longueur = _seq_elemId[index]->length();
1076 _seq_elemId[index]->length(longueur + nb_of_nodes);
1078 SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
1080 for(int k=0; itn->more(); k++)
1081 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
1084 _mapNbTypes[SALOME_MED::MED_FACE] =
1085 trouveTria3 + trouveTria6 + trouveQuad4;
1087 _mapIndToSeqElts[SALOME_MED::MED_HEXA8] = _indexElts++;
1088 _mapIndToVectTypes[SALOME_MED::MED_CELL] = _indexEnts++;
1089 int index = _mapIndToSeqElts[medElement];
1091 int trouveHexa8 = 0;
1093 SMDS_VolumeIteratorPtr itVolumes=_meshDS->volumesIterator();
1094 while(itVolumes->more())
1096 const SMDS_MeshVolume * elem = itVolumes->next();
1098 int nb_of_nodes = elem->NbNodes();
1099 medElement = SALOME_MED::MED_HEXA8;
1100 ASSERT(nb_of_nodes == 8);
1102 if (trouveHexa8 == 0)
1105 _TypesId[SALOME_MED::MED_CELL].push_back(SALOME_MED::MED_HEXA8);
1107 // Traitement de la maille
1108 int longueur = _seq_elemId[index]->length();
1109 _seq_elemId[index]->length(longueur + nb_of_nodes);
1111 SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
1112 for(int k=0; itn->more(); k++)
1113 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
1116 _mapNbTypes[SALOME_MED::MED_CELL] = trouveHexa8;
1117 _mapNbTypes[SALOME_MED::MED_ALL_ENTITIES]
1119 trouveHexa8 + trouveTria3 + trouveTria6 + trouveQuad4 + trouveSeg2 +
1124 //=============================================================================
1126 * Creation des familles
1128 //=============================================================================
1129 void SMESH_MEDMesh_i::createFamilies() throw(SALOME::SALOME_Exception)
1131 Unexpect aCatch(SALOME_SalomeException);
1132 string famDes = ("Je ne sais pas");
1133 string famName0 = "Famille_";
1137 if (_creeFamily == false)
1140 //SMESH_subMesh_i *subMeshServant;
1142 map < int, SMESH_subMesh_i * >::iterator it;
1143 for (it = _mesh_i->_mapSubMesh_i.begin();
1144 it != _mesh_i->_mapSubMesh_i.end(); it++)
1146 SMESH_subMesh_i *submesh_i = (*it).second;
1147 int famIdent = (*it).first;
1149 ASSERT(famIdent < 999999999);
1150 sprintf(numero, "%d\n", famIdent);
1151 famName = famName0 + numero;
1153 SMESH_MEDFamily_i *famservant =
1154 new SMESH_MEDFamily_i(famIdent, submesh_i,
1155 famName, famDes, SALOME_MED::MED_NODE);
1157 SALOME_MED::FAMILY_ptr famille = SALOME_MED::FAMILY::_nil();
1158 POA_SALOME_MED::FAMILY* servantbase = dynamic_cast<POA_SALOME_MED::FAMILY*>(famservant);
1160 famille = SALOME_MED::FAMILY::_narrow( servantbase->_this() );
1162 SALOME_MED::FAMILY_ptr famille =
1163 SALOME_MED::FAMILY::_narrow( famservant->POA_SALOME_MED::FAMILY::_this() );
1165 _families.push_back(famille);
1169 //=============================================================================
1171 * Gives informations of the considered mesh.
1173 //=============================================================================
1174 SALOME_MED::MESH::meshInfos * SMESH_MEDMesh_i::getMeshGlobal()
1175 throw (SALOME::SALOME_Exception)
1177 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1179 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1183 //=============================================================================
1185 * Gives informations on coordinates of the considered mesh.
1187 //=============================================================================
1188 SALOME_MED::MESH::coordinateInfos * SMESH_MEDMesh_i::getCoordGlobal()
1189 throw (SALOME::SALOME_Exception)
1191 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1193 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1197 //=============================================================================
1199 * Gives informations on connectivities of the considered mesh for the entity
1202 //=============================================================================
1203 SALOME_MED::MESH::connectivityInfos *
1204 SMESH_MEDMesh_i::getConnectGlobal(SALOME_MED::medEntityMesh entity)
1205 throw (SALOME::SALOME_Exception)
1207 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1209 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1213 //=============================================================================
1215 * Gives the type of the element number of entity entity
1217 //=============================================================================
1218 SALOME_MED::medGeometryElement
1219 SMESH_MEDMesh_i::getElementType(SALOME_MED::medEntityMesh entity,
1221 throw (SALOME::SALOME_Exception)
1223 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1225 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1227 return (SALOME_MED::medGeometryElement) 0;