1 // Copyright (C) 2007-2011 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"
35 #include <TopExp_Explorer.hxx>
37 #include <TopoDS_Iterator.hxx>
38 #include <TopoDS_Compound.hxx>
39 #include <TopoDS_CompSolid.hxx>
40 #include <TopoDS_Solid.hxx>
41 #include <TopoDS_Shell.hxx>
42 #include <TopoDS_Face.hxx>
43 #include <TopoDS_Wire.hxx>
44 #include <TopoDS_Edge.hxx>
45 #include <TopoDS_Vertex.hxx>
46 #include <TopoDS_Shape.hxx>
47 #include <TopTools_MapOfShape.hxx>
49 #include "utilities.h"
50 #include "Utils_CorbaException.hxx"
52 #include "SMESH_MEDSupport_i.hxx"
53 #include "SMESH_MEDFamily_i.hxx"
55 # include "Utils_ORB_INIT.hxx"
56 # include "Utils_SINGLETON.hxx"
57 # include "Utils_ExceptHandlers.hxx"
66 //=============================================================================
70 //=============================================================================
71 // PN Est-ce un const ?
72 SMESH_MEDMesh_i::SMESH_MEDMesh_i()
74 BEGIN_OF("Default Constructor SMESH_MEDMesh_i");
75 END_OF("Default Constructor SMESH_MEDMesh_i");
78 //=============================================================================
82 //=============================================================================
83 SMESH_MEDMesh_i::~SMESH_MEDMesh_i()
87 //=============================================================================
91 //=============================================================================
92 SMESH_MEDMesh_i::SMESH_MEDMesh_i(::SMESH_Mesh_i * m_i):_meshId(""),
99 BEGIN_OF("Constructor SMESH_MEDMesh_i");
102 _meshDS = _mesh_i->GetImpl().GetMeshDS();
104 END_OF("Constructor SMESH_MEDMesh_i");
107 //=============================================================================
109 * CORBA: Accessor for Name
111 //=============================================================================
112 char *SMESH_MEDMesh_i::getName() throw(SALOME::SALOME_Exception)
115 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
116 SALOME::INTERNAL_ERROR);
120 SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen();
121 SALOMEDS::Study_var study = gen->GetCurrentStudy();
122 SALOMEDS::SObject_var meshSO = gen->ObjectToSObject( study, _mesh_i->_this());
123 if ( meshSO->_is_nil() )
124 return CORBA::string_dup("toto");
126 CORBA::String_var name = meshSO->GetName();
127 return CORBA::string_dup( name.in() );
131 MESSAGE("Exception en accedant au nom");
132 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
133 SALOME::INTERNAL_ERROR);
138 //=============================================================================
140 * CORBA: Accessor for corbaindex cuisine interne
142 //=============================================================================
143 CORBA::Long SMESH_MEDMesh_i::getCorbaIndex()throw(SALOME::SALOME_Exception)
145 MESSAGE("Non Implemente");
146 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
149 //=============================================================================
151 * CORBA: Accessor for Space Dimension
153 //=============================================================================
154 CORBA::Long SMESH_MEDMesh_i::getSpaceDimension()throw(SALOME::SALOME_Exception)
156 // PN : Il semblerait que la dimension soit fixee a 3
158 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
159 SALOME::INTERNAL_ERROR);
163 //=============================================================================
165 * CORBA: Accessor for Mesh Dimension
167 //=============================================================================
168 CORBA::Long SMESH_MEDMesh_i::getMeshDimension()throw(SALOME::SALOME_Exception)
171 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
172 SALOME::INTERNAL_ERROR);
173 // PN : Il semblerait que la dimension soit fixee a 3
175 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
176 SALOME::INTERNAL_ERROR);
179 //=============================================================================
181 * CORBA: Accessor for the boolean _isAGrid
183 //=============================================================================
184 CORBA::Boolean SMESH_MEDMesh_i::getIsAGrid() throw (SALOME::SALOME_Exception)
186 MESSAGE("!!!!!! NOT YET IMPLEMENTED !!!!!!");
188 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
192 //=============================================================================
194 * CORBA: Accessor for the connectivities, to see if they exist
196 //=============================================================================
198 SMESH_MEDMesh_i::existConnectivity(SALOME_MED::medConnectivity connectivityType,
199 SALOME_MED::medEntityMesh entity)
200 throw (SALOME::SALOME_Exception)
202 MESSAGE("!!!!!! IMPLEMENTED BUT ONLY PARTIALLY !!!!!!");
208 //=============================================================================
210 * CORBA: Accessor for Coordinate
212 //=============================================================================
213 CORBA::Double SMESH_MEDMesh_i::getCoordinate(CORBA::Long Number, CORBA::Long Axis)
214 throw (SALOME::SALOME_Exception)
216 MESSAGE("!!!!!! NOT YET IMPLEMENTED !!!!");
218 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
222 //=============================================================================
224 * CORBA: Accessor for Coordinates System
226 //=============================================================================
227 char *SMESH_MEDMesh_i::getCoordinatesSystem() throw(SALOME::SALOME_Exception)
230 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
231 SALOME::INTERNAL_ERROR);
232 // PN : En dur. Non encore prevu
235 string systcoo = "CARTESIEN";
236 return CORBA::string_dup(systcoo.c_str());
240 MESSAGE("Exception en accedant au maillage");
241 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
242 SALOME::INTERNAL_ERROR);
246 //=============================================================================
248 * CORBA: Accessor for Coordinates
250 //=============================================================================
251 SALOME_TYPES::ListOfDouble * SMESH_MEDMesh_i::getCoordinates
252 (SALOME_MED::medModeSwitch typeSwitch) throw(SALOME::SALOME_Exception)
255 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
256 SALOME::INTERNAL_ERROR);
257 SALOME_TYPES::ListOfDouble_var myseq = new SALOME_TYPES::ListOfDouble;
261 int spaceDimension = 3;
262 int nbNodes = _meshDS->NbNodes();
264 myseq->length(nbNodes * spaceDimension);
267 SMDS_NodeIteratorPtr itNodes=_meshDS->nodesIterator();
268 while(itNodes->more())
270 const SMDS_MeshNode* node = itNodes->next();
272 if (typeSwitch == SALOME_MED::MED_FULL_INTERLACE)
274 myseq[i * 3] = node->X();
275 myseq[i * 3 + 1] = node->Y();
276 myseq[i * 3 + 2] = node->Z();
277 SCRUTE(myseq[i * 3]);
278 SCRUTE(myseq[i * 3 + 1]);
279 SCRUTE(myseq[i * 3 + 2]);
283 ASSERT(typeSwitch == SALOME_MED::MED_NO_INTERLACE);
284 myseq[i] = node->X();
285 myseq[i + nbNodes] = node->Y();
286 myseq[i + (nbNodes * 2)] = node->Z();
288 SCRUTE(myseq[i + nbNodes]);
289 SCRUTE(myseq[i + (nbNodes * 2)]);
296 MESSAGE("Exception en accedant aux coordonnees");
297 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
298 SALOME::INTERNAL_ERROR);
300 return myseq._retn();
303 //=============================================================================
305 * CORBA: Accessor for Coordinates Names
307 //=============================================================================
308 SALOME_TYPES::ListOfString *
309 SMESH_MEDMesh_i::getCoordinatesNames()throw(SALOME::SALOME_Exception)
312 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
313 SALOME::INTERNAL_ERROR);
314 SALOME_TYPES::ListOfString_var myseq = new SALOME_TYPES::ListOfString;
318 int spaceDimension = 3;
319 myseq->length(spaceDimension);
320 myseq[0] = CORBA::string_dup("x");
321 myseq[1] = CORBA::string_dup("y");
322 myseq[2] = CORBA::string_dup("z");
326 MESSAGE("Exception en accedant aux noms des coordonnees");
327 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
328 SALOME::INTERNAL_ERROR);
330 return myseq._retn();
334 //=============================================================================
336 * CORBA: Accessor for Coordinates Units
338 //=============================================================================
339 SALOME_TYPES::ListOfString *
340 SMESH_MEDMesh_i::getCoordinatesUnits()throw(SALOME::SALOME_Exception)
343 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
344 SALOME::INTERNAL_ERROR);
345 SALOME_TYPES::ListOfString_var myseq = new SALOME_TYPES::ListOfString;
349 int spaceDimension = 3;
350 myseq->length(spaceDimension);
351 myseq[0] = CORBA::string_dup("m");
352 myseq[1] = CORBA::string_dup("m");
353 myseq[2] = CORBA::string_dup("m");
357 MESSAGE("Exception en accedant aux unites des coordonnees");
358 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
359 SALOME::INTERNAL_ERROR);
361 return myseq._retn();
364 //=============================================================================
366 * CORBA: Accessor for Number of Nodes
368 //=============================================================================
369 CORBA::Long SMESH_MEDMesh_i::getNumberOfNodes()throw(SALOME::SALOME_Exception)
372 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
373 SALOME::INTERNAL_ERROR);
376 return _meshDS->NbNodes();
380 MESSAGE("Exception en accedant au nombre de noeuds");
381 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
382 SALOME::INTERNAL_ERROR);
386 //=============================================================================
388 * CORBA: Accessor for number of Types
390 //=============================================================================
391 CORBA::Long SMESH_MEDMesh_i::getNumberOfTypes(SALOME_MED::medEntityMesh entity)
392 throw(SALOME::SALOME_Exception)
395 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
396 SALOME::INTERNAL_ERROR);
402 if (_mapNbTypes.find(entity) != _mapNbTypes.end())
403 retour = _mapNbTypes[entity];
408 MESSAGE("Exception en accedant au nombre de Types");
409 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
410 SALOME::INTERNAL_ERROR);
414 //=============================================================================
416 * CORBA: Accessor for existing geometry element types
417 * Not implemented for MED_ALL_ENTITIES
419 //=============================================================================
420 SALOME_MED::medGeometryElement_array *
421 SMESH_MEDMesh_i::getTypes(SALOME_MED::medEntityMesh entity) throw(SALOME::
425 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
426 SALOME::INTERNAL_ERROR);
427 if (entity == SALOME_MED::MED_ALL_ENTITIES)
428 THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ENTITIES",
432 SALOME_MED::medGeometryElement_array_var myseq =
433 new SALOME_MED::medGeometryElement_array;
436 if (_mapNbTypes.find(entity) == _mapNbTypes.end())
437 THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh",
439 int nbTypes = _mapNbTypes[entity];
441 myseq->length(nbTypes);
443 if (_mapIndToVectTypes.find(entity) == _mapIndToVectTypes.end())
444 THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh",
445 SALOME::INTERNAL_ERROR);
447 int index = _mapIndToVectTypes[entity];
448 ASSERT(_TypesId[index].size() != 0);
450 vector < SALOME_MED::medGeometryElement >::iterator it;
451 for (it = _TypesId[index].begin(); it != _TypesId[index].end(); it++)
458 MESSAGE("Exception en accedant aux differents types");
459 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
460 SALOME::INTERNAL_ERROR);
462 return myseq._retn();
465 //=============================================================================
467 * CORBA: Returns number of elements of type medGeometryElement
468 * Not implemented for MED_ALL_ELEMENTS
469 * implemented for MED_ALL_ENTITIES
471 * Dans cette implementation, il n est pas prevu de tenir compte du entity
472 * qui ne doit pas pouvoir avoir deux valeurs differentes pour un geomElement
474 //=============================================================================
475 CORBA::Long SMESH_MEDMesh_i::getNumberOfElements(SALOME_MED::
476 medEntityMesh entity,
477 SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
480 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
481 SALOME::INTERNAL_ERROR);
482 if (geomElement == SALOME_MED::MED_ALL_ELEMENTS)
483 THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ELEMENTS",
491 if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end())
493 int index = _mapIndToSeqElts[geomElement];
495 retour = _seq_elemId[index]->length();
501 MESSAGE("Exception en accedant au nombre d élements");
502 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
503 SALOME::INTERNAL_ERROR);
507 //=============================================================================
509 * CORBA: Accessor for connectivities
511 //=============================================================================
512 SALOME_TYPES::ListOfLong *
513 SMESH_MEDMesh_i::getConnectivity(SALOME_MED::medConnectivity mode,
514 SALOME_MED::medEntityMesh entity,
515 SALOME_MED::medGeometryElement geomElement)
516 throw(SALOME::SALOME_Exception)
519 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
520 SALOME::INTERNAL_ERROR);
521 if (mode != SALOME_MED::MED_NODAL)
522 THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
523 /*if (typeSwitch == SALOME_MED::MED_NO_INTERLACE)
524 THROW_SALOME_CORBA_EXCEPTION("Not Yet Implemented", SALOME::BAD_PARAM);*/
528 // Faut-il renvoyer un pointeur vide ???
529 if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end())
530 THROW_SALOME_CORBA_EXCEPTION("No Such Element in the mesh",
533 int index = _mapIndToSeqElts[geomElement];
535 return _seq_elemId[index]._retn();
538 //=============================================================================
540 * CORBA: Accessor for connectivities
542 //=============================================================================
543 SALOME_TYPES::ListOfLong *
544 SMESH_MEDMesh_i::getConnectivityIndex(SALOME_MED::medConnectivity mode,
545 SALOME_MED::medEntityMesh entity)
546 throw(SALOME::SALOME_Exception)
548 MESSAGE("Pas Implemente dans SMESH");
549 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
553 //=============================================================================
555 * CORBA: Find an element corresponding to the given connectivity
557 //=============================================================================
559 SMESH_MEDMesh_i::getElementNumber(SALOME_MED::medConnectivity mode,
560 SALOME_MED::medEntityMesh entity,
561 SALOME_MED::medGeometryElement type,
562 const SALOME_TYPES::ListOfLong & connectivity)
563 throw(SALOME::SALOME_Exception)
565 const char *LOC = "getElementNumber ";
566 MESSAGE(LOC << "Pas Implemente dans SMESH");
567 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
571 //=============================================================================
573 * CORBA: Accessor for Ascendant connectivities
574 * not implemented for MED_ALL_ENTITIES and MED_MAILLE
576 //=============================================================================
577 SALOME_TYPES::ListOfLong *
578 SMESH_MEDMesh_i::getReverseConnectivity(SALOME_MED::
579 medConnectivity mode) throw(SALOME::SALOME_Exception)
581 MESSAGE("Pas Implemente dans SMESH");
582 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
586 //=============================================================================
588 * CORBA: Accessor for connectivities
590 //=============================================================================
591 SALOME_TYPES::ListOfLong *
592 SMESH_MEDMesh_i::getReverseConnectivityIndex(SALOME_MED::
593 medConnectivity mode) throw(SALOME::SALOME_Exception)
595 MESSAGE("Pas Implemente dans SMESH");
596 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
600 //=============================================================================
602 * CORBA: Returns number of families within the mesh
604 //=============================================================================
605 CORBA::Long SMESH_MEDMesh_i::getNumberOfFamilies(SALOME_MED::
606 medEntityMesh entity) throw(SALOME::SALOME_Exception)
608 if (_creeFamily == false)
611 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
612 SALOME::INTERNAL_ERROR);
613 return _families.size();
616 //=============================================================================
618 * CORBA: Returns number of groups within the mesh
620 //=============================================================================
621 CORBA::Long SMESH_MEDMesh_i::getNumberOfGroups(SALOME_MED::medEntityMesh entity)
622 throw(SALOME::SALOME_Exception)
625 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
626 SALOME::INTERNAL_ERROR);
627 MESSAGE(" Pas d implementation des groupes dans SMESH");
631 //=============================================================================
633 * CORBA: Returns references for families within the mesh
635 //=============================================================================
636 SALOME_MED::Family_array *
637 SMESH_MEDMesh_i::getFamilies(SALOME_MED::
638 medEntityMesh entity) throw(SALOME::SALOME_Exception)
640 if (_creeFamily == false)
643 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
644 SALOME::INTERNAL_ERROR);
645 SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array;
646 int nbfam = _families.size();
647 myseq->length(nbfam);
649 vector < SALOME_MED::FAMILY_ptr >::iterator it;
650 for (it = _families.begin(); it != _families.end(); it++)
654 return myseq._retn();
657 //=============================================================================
659 * CORBA: Returns references for family i within the mesh
661 //=============================================================================
662 SALOME_MED::FAMILY_ptr SMESH_MEDMesh_i::getFamily(SALOME_MED::
663 medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception)
665 if (_creeFamily == false)
668 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
669 SALOME::INTERNAL_ERROR);
671 SCRUTE(_families[i]->getName());
672 MESSAGE(" SMESH_MEDMesh_i::getFamily " << i) return _families[i];
675 //=============================================================================
677 * CORBA: Returns references for groups within the mesh
679 //=============================================================================
680 SALOME_MED::Group_array *
681 SMESH_MEDMesh_i::getGroups(SALOME_MED::medEntityMesh entity) throw(SALOME::
685 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
686 SALOME::INTERNAL_ERROR);
687 MESSAGE(" Pas d implementation des groupes dans SMESH");
688 THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
691 //=============================================================================
693 * CORBA: Returns references for group i within the mesh
695 //=============================================================================
696 SALOME_MED::GROUP_ptr SMESH_MEDMesh_i::getGroup(SALOME_MED::
697 medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception)
700 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
701 SALOME::INTERNAL_ERROR);
702 MESSAGE(" Pas d implementation des groupes dans SMESH");
703 THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
705 //=============================================================================
707 * CORBA: Returns references for the global numbering index
709 //=============================================================================
710 SALOME_TYPES::ListOfLong*
711 SMESH_MEDMesh_i::getGlobalNumberingIndex(SALOME_MED::medEntityMesh entity)
712 throw (SALOME::SALOME_Exception)
714 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
716 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
720 //=============================================================================
722 * CORBA: Returns references for the support of boundary elements of type
725 //=============================================================================
726 SALOME_MED::SUPPORT_ptr
727 SMESH_MEDMesh_i::getBoundaryElements(SALOME_MED::medEntityMesh entity)
728 throw (SALOME::SALOME_Exception)
730 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
732 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
736 //=============================================================================
738 * CORBA: Method return a reference on a support define on all the element of
741 //=============================================================================
742 SALOME_MED::SUPPORT_ptr
743 SMESH_MEDMesh_i::getSupportOnAll(SALOME_MED::medEntityMesh entity)
744 throw (SALOME::SALOME_Exception)
746 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
748 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
752 //=============================================================================
754 * CORBA: Returns references for the support of the skin of the support
757 //=============================================================================
758 SALOME_MED::SUPPORT_ptr
759 SMESH_MEDMesh_i::getSkin(SALOME_MED::SUPPORT_ptr mySupport3D)
760 throw (SALOME::SALOME_Exception)
762 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
764 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
768 //=============================================================================
772 //=============================================================================
773 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getVolume(SALOME_MED::
774 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
776 MESSAGE("Pas Implemente dans SMESH");
777 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
781 //=============================================================================
785 //=============================================================================
786 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getArea(SALOME_MED::
787 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
789 MESSAGE("Pas Implemente dans SMESH");
790 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
794 //=============================================================================
798 //=============================================================================
799 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getLength(SALOME_MED::
800 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
802 MESSAGE("Pas Implemente dans SMESH");
803 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
807 //=============================================================================
811 //=============================================================================
812 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNormal(SALOME_MED::
813 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
815 MESSAGE("Pas Implemente dans SMESH");
816 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
820 //=============================================================================
824 //=============================================================================
825 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getBarycenter(SALOME_MED::
826 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
828 MESSAGE("Pas Implemente dans SMESH");
829 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
833 //=============================================================================
837 //=============================================================================
838 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNeighbourhood(SALOME_MED::
839 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
841 MESSAGE("Non Implemente");
842 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
846 //=============================================================================
848 * CORBA: add the Mesh in the StudyManager
851 //=============================================================================
852 void SMESH_MEDMesh_i::addInStudy(SALOMEDS::Study_ptr myStudy,
853 SALOME_MED::GMESH_ptr myIor) throw(SALOME::SALOME_Exception)
855 BEGIN_OF("MED_Mesh_i::addInStudy");
858 MESSAGE("Mesh already in Study");
859 THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study",
864 * SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
866 * // Create SComponent labelled 'MED' if it doesn't already exit
867 * SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
868 * if ( CORBA::is_nil(medfather) )
870 * MESSAGE("Add Component MED");
871 * medfather = myBuilder->NewComponent("MED");
872 * //myBuilder->AddAttribute (medfather,SALOMEDS::Name,"MED");
873 * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
874 * myBuilder->FindOrCreateAttribute(medfather, "AttributeName"));
875 * aName->SetValue("MED");
877 * myBuilder->DefineComponentInstance(medfather,myIor);
881 * MESSAGE("Add a mesh Object under MED");
882 * myBuilder->NewCommand();
883 * SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfather);
885 * ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
886 * ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
887 * CORBA::ORB_var &orb = init(0,0);
888 * CORBA::String_var iorStr = orb->object_to_string(myIor);
889 * //myBuilder->AddAttribute(newObj,SALOMEDS::IOR,iorStr.in());
890 * SALOMEDS::AttributeIOR_var aIOR = SALOMEDS::AttributeIOR::_narrow(
891 * myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"));
892 * aIOR->SetValue(iorStr.c_str());
894 * //myBuilder->AddAttribute(newObj,SALOMEDS::Name,_mesh_i->getName().c_str());
895 * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
896 * myBuilder->FindOrCreateAttribute(newObj, "AttributeName"));
897 * aName->SetValue(_mesh_i->getName().c_str());
899 * _meshId = newObj->GetID();
900 * myBuilder->CommitCommand();
903 END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
906 //=============================================================================
908 * CORBA: write mesh in a med file
910 //=============================================================================
911 void SMESH_MEDMesh_i::write(CORBA::Long i, const char *driverMeshName)
912 throw(SALOME::SALOME_Exception)
914 MESSAGE("Non Implemente");
915 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
918 //=============================================================================
920 * CORBA: read mesh in a med file
922 //=============================================================================
923 void SMESH_MEDMesh_i::read(CORBA::Long i) throw(SALOME::SALOME_Exception)
925 MESSAGE("Non Implemente");
926 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
929 //=============================================================================
931 * CORBA : release driver
933 //=============================================================================
934 void SMESH_MEDMesh_i::rmDriver(CORBA::Long i) throw(SALOME::SALOME_Exception)
936 MESSAGE("Non Implemente");
937 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
940 //=============================================================================
942 * CORBA : attach driver
944 //=============================================================================
945 CORBA::Long SMESH_MEDMesh_i::addDriver(SALOME_MED::medDriverTypes driverType,
946 const char *fileName, const char *meshName) throw(SALOME::SALOME_Exception)
948 MESSAGE("Non Implemente");
949 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
953 //=============================================================================
955 * Calcule le Nb d'elements par entite geometrique
957 //=============================================================================
958 void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception)
964 _mapNbTypes[SALOME_MED::MED_NODE] = 1;
965 // On compte les aretes MED_SEG2 ou MED_SEG3
966 // On range les elements dans les vecteurs correspondants
968 _mapIndToSeqElts[SALOME_MED::MED_SEG2] = _indexElts++;
969 _mapIndToSeqElts[SALOME_MED::MED_SEG3] = _indexElts++;
970 _mapIndToVectTypes[SALOME_MED::MED_EDGE] = _indexEnts++;
974 SALOME_MED::medGeometryElement medElement;
976 SMDS_EdgeIteratorPtr itEdges=_meshDS->edgesIterator();
977 while(itEdges->more())
979 const SMDS_MeshEdge* elem = itEdges->next();
980 int nb_of_nodes = elem->NbNodes();
986 medElement = SALOME_MED::MED_SEG2;
990 _TypesId[SALOME_MED::MED_EDGE].
991 push_back(SALOME_MED::MED_SEG2);
997 medElement = SALOME_MED::MED_SEG3;
1001 _TypesId[SALOME_MED::MED_EDGE].
1002 push_back(SALOME_MED::MED_SEG3);
1007 int index = _mapIndToSeqElts[medElement];
1009 // Traitement de l arete
1011 int longueur = _seq_elemId[index]->length();
1012 _seq_elemId[index]->length(longueur + nb_of_nodes);
1014 SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
1016 for(int k=0; itn->more(); k++)
1017 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
1020 _mapNbTypes[SALOME_MED::MED_EDGE] = trouveSeg2 + trouveSeg3;
1022 // On compte les faces MED_TRIA3, MED_HEXA8, MED_TRIA6
1023 // On range les elements dans les vecteurs correspondants
1024 int trouveTria3 = 0;
1025 int trouveTria6 = 0;
1026 int trouveQuad4 = 0;
1028 _mapIndToSeqElts[SALOME_MED::MED_TRIA3] = _indexElts++;
1029 _mapIndToSeqElts[SALOME_MED::MED_TRIA6] = _indexElts++;
1030 _mapIndToSeqElts[SALOME_MED::MED_QUAD4] = _indexElts++;
1031 _mapIndToVectTypes[SALOME_MED::MED_FACE] = _indexEnts++;
1033 SMDS_FaceIteratorPtr itFaces=_meshDS->facesIterator();
1034 while(itFaces->more())
1036 const SMDS_MeshFace * elem = itFaces->next();
1037 int nb_of_nodes = elem->NbNodes();
1039 switch (nb_of_nodes)
1043 medElement = SALOME_MED::MED_TRIA3;
1044 if (trouveTria3 == 0)
1047 _TypesId[SALOME_MED::MED_FACE].
1048 push_back(SALOME_MED::MED_TRIA3);
1054 medElement = SALOME_MED::MED_QUAD4;
1055 if (trouveQuad4 == 0)
1058 _TypesId[SALOME_MED::MED_FACE].
1059 push_back(SALOME_MED::MED_QUAD4);
1065 medElement = SALOME_MED::MED_TRIA6;
1066 if (trouveTria6 == 0)
1069 _TypesId[SALOME_MED::MED_FACE].
1070 push_back(SALOME_MED::MED_TRIA6);
1075 int index = _mapIndToSeqElts[medElement];
1078 // Traitement de la face
1079 // Attention La numérotation des noeuds Med commence a 1
1081 int longueur = _seq_elemId[index]->length();
1082 _seq_elemId[index]->length(longueur + nb_of_nodes);
1084 SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
1086 for(int k=0; itn->more(); k++)
1087 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
1090 _mapNbTypes[SALOME_MED::MED_FACE] =
1091 trouveTria3 + trouveTria6 + trouveQuad4;
1093 _mapIndToSeqElts[SALOME_MED::MED_HEXA8] = _indexElts++;
1094 _mapIndToVectTypes[SALOME_MED::MED_CELL] = _indexEnts++;
1095 int index = _mapIndToSeqElts[medElement];
1097 int trouveHexa8 = 0;
1099 SMDS_VolumeIteratorPtr itVolumes=_meshDS->volumesIterator();
1100 while(itVolumes->more())
1102 const SMDS_MeshVolume * elem = itVolumes->next();
1104 int nb_of_nodes = elem->NbNodes();
1105 medElement = SALOME_MED::MED_HEXA8;
1106 ASSERT(nb_of_nodes == 8);
1108 if (trouveHexa8 == 0)
1111 _TypesId[SALOME_MED::MED_CELL].push_back(SALOME_MED::MED_HEXA8);
1113 // Traitement de la maille
1114 int longueur = _seq_elemId[index]->length();
1115 _seq_elemId[index]->length(longueur + nb_of_nodes);
1117 SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
1118 for(int k=0; itn->more(); k++)
1119 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
1122 _mapNbTypes[SALOME_MED::MED_CELL] = trouveHexa8;
1123 _mapNbTypes[SALOME_MED::MED_ALL_ENTITIES]
1125 trouveHexa8 + trouveTria3 + trouveTria6 + trouveQuad4 + trouveSeg2 +
1130 //=============================================================================
1132 * Creation des familles
1134 //=============================================================================
1135 void SMESH_MEDMesh_i::createFamilies() throw(SALOME::SALOME_Exception)
1137 Unexpect aCatch(SALOME_SalomeException);
1138 string famDes = ("Je ne sais pas");
1139 string famName0 = "Famille_";
1143 if (_creeFamily == false)
1146 //SMESH_subMesh_i *subMeshServant;
1148 map < int, SMESH_subMesh_i * >::iterator it;
1149 for (it = _mesh_i->_mapSubMesh_i.begin();
1150 it != _mesh_i->_mapSubMesh_i.end(); it++)
1152 SMESH_subMesh_i *submesh_i = (*it).second;
1153 int famIdent = (*it).first;
1155 ASSERT(famIdent < 999999999);
1156 sprintf(numero, "%d\n", famIdent);
1157 famName = famName0 + numero;
1159 SMESH_MEDFamily_i *famservant =
1160 new SMESH_MEDFamily_i(famIdent, submesh_i,
1161 famName, famDes, SALOME_MED::MED_NODE);
1163 SALOME_MED::FAMILY_ptr famille = SALOME_MED::FAMILY::_nil();
1164 POA_SALOME_MED::FAMILY* servantbase = dynamic_cast<POA_SALOME_MED::FAMILY*>(famservant);
1166 famille = SALOME_MED::FAMILY::_narrow( servantbase->_this() );
1168 SALOME_MED::FAMILY_ptr famille =
1169 SALOME_MED::FAMILY::_narrow( famservant->POA_SALOME_MED::FAMILY::_this() );
1171 _families.push_back(famille);
1175 //=============================================================================
1177 * Gives informations of the considered mesh.
1179 //=============================================================================
1180 SALOME_MED::GMESH::meshInfos * SMESH_MEDMesh_i::getMeshGlobal()
1181 throw (SALOME::SALOME_Exception)
1183 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1185 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1190 //================================================================================
1192 * \brief Converts this GMESH into MESH
1194 //================================================================================
1196 SALOME_MED::MESH_ptr SMESH_MEDMesh_i::convertInMESH() throw (SALOME::SALOME_Exception)
1198 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1200 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1205 //=============================================================================
1207 * Gives informations on coordinates of the considered mesh.
1209 //=============================================================================
1210 SALOME_MED::GMESH::coordinateInfos * SMESH_MEDMesh_i::getCoordGlobal()
1211 throw (SALOME::SALOME_Exception)
1213 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1215 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1219 //=============================================================================
1221 * Gives informations on connectivities of the considered mesh for the entity
1224 //=============================================================================
1225 SALOME_MED::MESH::connectivityInfos *
1226 SMESH_MEDMesh_i::getConnectGlobal(SALOME_MED::medEntityMesh entity)
1227 throw (SALOME::SALOME_Exception)
1229 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1231 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1235 //=============================================================================
1237 * Gives the type of the element number of entity entity
1239 //=============================================================================
1240 SALOME_MED::medGeometryElement
1241 SMESH_MEDMesh_i::getElementType(SALOME_MED::medEntityMesh entity,
1243 throw (SALOME::SALOME_Exception)
1245 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1247 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1249 return (SALOME_MED::medGeometryElement) 0;