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);
745 //=============================================================================
747 * CORBA: Returns references for the support of the skin of the support
750 //=============================================================================
751 SALOME_MED::SUPPORT_ptr
752 SMESH_MEDMesh_i::getSkin(SALOME_MED::SUPPORT_ptr mySupport3D)
753 throw (SALOME::SALOME_Exception)
755 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
757 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
761 //=============================================================================
765 //=============================================================================
766 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getVolume(SALOME_MED::
767 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
769 MESSAGE("Pas Implemente dans SMESH");
770 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
774 //=============================================================================
778 //=============================================================================
779 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getArea(SALOME_MED::
780 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
782 MESSAGE("Pas Implemente dans SMESH");
783 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
787 //=============================================================================
791 //=============================================================================
792 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getLength(SALOME_MED::
793 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
795 MESSAGE("Pas Implemente dans SMESH");
796 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
800 //=============================================================================
804 //=============================================================================
805 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNormal(SALOME_MED::
806 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
808 MESSAGE("Pas Implemente dans SMESH");
809 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
813 //=============================================================================
817 //=============================================================================
818 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getBarycenter(SALOME_MED::
819 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
821 MESSAGE("Pas Implemente dans SMESH");
822 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
826 //=============================================================================
830 //=============================================================================
831 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNeighbourhood(SALOME_MED::
832 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
834 MESSAGE("Non Implemente");
835 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
839 //=============================================================================
841 * CORBA: add the Mesh in the StudyManager
844 //=============================================================================
845 void SMESH_MEDMesh_i::addInStudy(SALOMEDS::Study_ptr myStudy,
846 SALOME_MED::MESH_ptr myIor) throw(SALOME::SALOME_Exception)
848 BEGIN_OF("MED_Mesh_i::addInStudy");
851 MESSAGE("Mesh already in Study");
852 THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study",
857 * SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
859 * // Create SComponent labelled 'MED' if it doesn't already exit
860 * SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
861 * if ( CORBA::is_nil(medfather) )
863 * MESSAGE("Add Component MED");
864 * medfather = myBuilder->NewComponent("MED");
865 * //myBuilder->AddAttribute (medfather,SALOMEDS::Name,"MED");
866 * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
867 * myBuilder->FindOrCreateAttribute(medfather, "AttributeName"));
868 * aName->SetValue("MED");
870 * myBuilder->DefineComponentInstance(medfather,myIor);
874 * MESSAGE("Add a mesh Object under MED");
875 * myBuilder->NewCommand();
876 * SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfather);
878 * ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
879 * ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
880 * CORBA::ORB_var &orb = init(0,0);
881 * CORBA::String_var iorStr = orb->object_to_string(myIor);
882 * //myBuilder->AddAttribute(newObj,SALOMEDS::IOR,iorStr.in());
883 * SALOMEDS::AttributeIOR_var aIOR = SALOMEDS::AttributeIOR::_narrow(
884 * myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"));
885 * aIOR->SetValue(iorStr.c_str());
887 * //myBuilder->AddAttribute(newObj,SALOMEDS::Name,_mesh_i->getName().c_str());
888 * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
889 * myBuilder->FindOrCreateAttribute(newObj, "AttributeName"));
890 * aName->SetValue(_mesh_i->getName().c_str());
892 * _meshId = newObj->GetID();
893 * myBuilder->CommitCommand();
896 END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
899 //=============================================================================
901 * CORBA: write mesh in a med file
903 //=============================================================================
904 void SMESH_MEDMesh_i::write(CORBA::Long i, const char *driverMeshName)
905 throw(SALOME::SALOME_Exception)
907 MESSAGE("Non Implemente");
908 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
911 //=============================================================================
913 * CORBA: read mesh in a med file
915 //=============================================================================
916 void SMESH_MEDMesh_i::read(CORBA::Long i) throw(SALOME::SALOME_Exception)
918 MESSAGE("Non Implemente");
919 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
922 //=============================================================================
924 * CORBA : release driver
926 //=============================================================================
927 void SMESH_MEDMesh_i::rmDriver(CORBA::Long i) throw(SALOME::SALOME_Exception)
929 MESSAGE("Non Implemente");
930 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
933 //=============================================================================
935 * CORBA : attach driver
937 //=============================================================================
938 CORBA::Long SMESH_MEDMesh_i::addDriver(SALOME_MED::medDriverTypes driverType,
939 const char *fileName, const char *meshName) throw(SALOME::SALOME_Exception)
941 MESSAGE("Non Implemente");
942 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
946 //=============================================================================
948 * Calcule le Nb d'elements par entite geometrique
950 //=============================================================================
951 void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception)
957 _mapNbTypes[SALOME_MED::MED_NODE] = 1;
958 // On compte les aretes MED_SEG2 ou MED_SEG3
959 // On range les elements dans les vecteurs correspondants
961 _mapIndToSeqElts[SALOME_MED::MED_SEG2] = _indexElts++;
962 _mapIndToSeqElts[SALOME_MED::MED_SEG3] = _indexElts++;
963 _mapIndToVectTypes[SALOME_MED::MED_EDGE] = _indexEnts++;
967 SALOME_MED::medGeometryElement medElement;
969 SMDS_EdgeIteratorPtr itEdges=_meshDS->edgesIterator();
970 while(itEdges->more())
972 const SMDS_MeshEdge* elem = itEdges->next();
973 int nb_of_nodes = elem->NbNodes();
979 medElement = SALOME_MED::MED_SEG2;
983 _TypesId[SALOME_MED::MED_EDGE].
984 push_back(SALOME_MED::MED_SEG2);
990 medElement = SALOME_MED::MED_SEG3;
994 _TypesId[SALOME_MED::MED_EDGE].
995 push_back(SALOME_MED::MED_SEG3);
1000 int index = _mapIndToSeqElts[medElement];
1002 // Traitement de l arete
1004 int longueur = _seq_elemId[index]->length();
1005 _seq_elemId[index]->length(longueur + nb_of_nodes);
1007 SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
1009 for(int k=0; itn->more(); k++)
1010 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
1013 _mapNbTypes[SALOME_MED::MED_EDGE] = trouveSeg2 + trouveSeg3;
1015 // On compte les faces MED_TRIA3, MED_HEXA8, MED_TRIA6
1016 // On range les elements dans les vecteurs correspondants
1017 int trouveTria3 = 0;
1018 int trouveTria6 = 0;
1019 int trouveQuad4 = 0;
1021 _mapIndToSeqElts[SALOME_MED::MED_TRIA3] = _indexElts++;
1022 _mapIndToSeqElts[SALOME_MED::MED_TRIA6] = _indexElts++;
1023 _mapIndToSeqElts[SALOME_MED::MED_QUAD4] = _indexElts++;
1024 _mapIndToVectTypes[SALOME_MED::MED_FACE] = _indexEnts++;
1026 SMDS_FaceIteratorPtr itFaces=_meshDS->facesIterator();
1027 while(itFaces->more())
1029 const SMDS_MeshFace * elem = itFaces->next();
1030 int nb_of_nodes = elem->NbNodes();
1032 switch (nb_of_nodes)
1036 medElement = SALOME_MED::MED_TRIA3;
1037 if (trouveTria3 == 0)
1040 _TypesId[SALOME_MED::MED_FACE].
1041 push_back(SALOME_MED::MED_TRIA3);
1047 medElement = SALOME_MED::MED_QUAD4;
1048 if (trouveQuad4 == 0)
1051 _TypesId[SALOME_MED::MED_FACE].
1052 push_back(SALOME_MED::MED_QUAD4);
1058 medElement = SALOME_MED::MED_TRIA6;
1059 if (trouveTria6 == 0)
1062 _TypesId[SALOME_MED::MED_FACE].
1063 push_back(SALOME_MED::MED_TRIA6);
1068 int index = _mapIndToSeqElts[medElement];
1071 // Traitement de la face
1072 // Attention La numérotation des noeuds Med commence a 1
1074 int longueur = _seq_elemId[index]->length();
1075 _seq_elemId[index]->length(longueur + nb_of_nodes);
1077 SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
1079 for(int k=0; itn->more(); k++)
1080 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
1083 _mapNbTypes[SALOME_MED::MED_FACE] =
1084 trouveTria3 + trouveTria6 + trouveQuad4;
1086 _mapIndToSeqElts[SALOME_MED::MED_HEXA8] = _indexElts++;
1087 _mapIndToVectTypes[SALOME_MED::MED_CELL] = _indexEnts++;
1088 int index = _mapIndToSeqElts[medElement];
1090 int trouveHexa8 = 0;
1092 SMDS_VolumeIteratorPtr itVolumes=_meshDS->volumesIterator();
1093 while(itVolumes->more())
1095 const SMDS_MeshVolume * elem = itVolumes->next();
1097 int nb_of_nodes = elem->NbNodes();
1098 medElement = SALOME_MED::MED_HEXA8;
1099 ASSERT(nb_of_nodes == 8);
1101 if (trouveHexa8 == 0)
1104 _TypesId[SALOME_MED::MED_CELL].push_back(SALOME_MED::MED_HEXA8);
1106 // Traitement de la maille
1107 int longueur = _seq_elemId[index]->length();
1108 _seq_elemId[index]->length(longueur + nb_of_nodes);
1110 SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
1111 for(int k=0; itn->more(); k++)
1112 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
1115 _mapNbTypes[SALOME_MED::MED_CELL] = trouveHexa8;
1116 _mapNbTypes[SALOME_MED::MED_ALL_ENTITIES]
1118 trouveHexa8 + trouveTria3 + trouveTria6 + trouveQuad4 + trouveSeg2 +
1123 //=============================================================================
1125 * Creation des familles
1127 //=============================================================================
1128 void SMESH_MEDMesh_i::createFamilies() throw(SALOME::SALOME_Exception)
1130 Unexpect aCatch(SALOME_SalomeException);
1131 string famDes = ("Je ne sais pas");
1132 string famName0 = "Famille_";
1136 if (_creeFamily == false)
1139 //SMESH_subMesh_i *subMeshServant;
1141 map < int, SMESH_subMesh_i * >::iterator it;
1142 for (it = _mesh_i->_mapSubMesh_i.begin();
1143 it != _mesh_i->_mapSubMesh_i.end(); it++)
1145 SMESH_subMesh_i *submesh_i = (*it).second;
1146 int famIdent = (*it).first;
1148 ASSERT(famIdent < 999999999);
1149 sprintf(numero, "%d\n", famIdent);
1150 famName = famName0 + numero;
1152 SMESH_MEDFamily_i *famservant =
1153 new SMESH_MEDFamily_i(famIdent, submesh_i,
1154 famName, famDes, SALOME_MED::MED_NODE);
1156 SALOME_MED::FAMILY_ptr famille = SALOME_MED::FAMILY::_nil();
1157 POA_SALOME_MED::FAMILY* servantbase = dynamic_cast<POA_SALOME_MED::FAMILY*>(famservant);
1159 famille = SALOME_MED::FAMILY::_narrow( servantbase->_this() );
1161 SALOME_MED::FAMILY_ptr famille =
1162 SALOME_MED::FAMILY::_narrow( famservant->POA_SALOME_MED::FAMILY::_this() );
1164 _families.push_back(famille);
1168 //=============================================================================
1170 * Gives informations of the considered mesh.
1172 //=============================================================================
1173 SALOME_MED::MESH::meshInfos * SMESH_MEDMesh_i::getMeshGlobal()
1174 throw (SALOME::SALOME_Exception)
1176 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1178 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1182 //=============================================================================
1184 * Gives informations on coordinates of the considered mesh.
1186 //=============================================================================
1187 SALOME_MED::MESH::coordinateInfos * SMESH_MEDMesh_i::getCoordGlobal()
1188 throw (SALOME::SALOME_Exception)
1190 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1192 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1196 //=============================================================================
1198 * Gives informations on connectivities of the considered mesh for the entity
1201 //=============================================================================
1202 SALOME_MED::MESH::connectivityInfos *
1203 SMESH_MEDMesh_i::getConnectGlobal(SALOME_MED::medEntityMesh entity)
1204 throw (SALOME::SALOME_Exception)
1206 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1208 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1212 //=============================================================================
1214 * Gives the type of the element number of entity entity
1216 //=============================================================================
1217 SALOME_MED::medGeometryElement
1218 SMESH_MEDMesh_i::getElementType(SALOME_MED::medEntityMesh entity,
1220 throw (SALOME::SALOME_Exception)
1222 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1224 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1226 return (SALOME_MED::medGeometryElement) 0;