1 // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
3 // Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMESH_MEDMesh_i.cxx
28 #include "SMESH_MEDMesh_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"
62 //=============================================================================
66 //=============================================================================
67 // PN Est-ce un const ?
68 SMESH_MEDMesh_i::SMESH_MEDMesh_i()
70 BEGIN_OF("Default Constructor SMESH_MEDMesh_i");
71 END_OF("Default Constructor SMESH_MEDMesh_i");
74 //=============================================================================
78 //=============================================================================
79 SMESH_MEDMesh_i::~SMESH_MEDMesh_i()
83 //=============================================================================
87 //=============================================================================
88 SMESH_MEDMesh_i::SMESH_MEDMesh_i(::SMESH_Mesh_i * m_i):_meshId(""),
95 BEGIN_OF("Constructor SMESH_MEDMesh_i");
98 _meshDS = _mesh_i->GetImpl().GetMeshDS();
100 END_OF("Constructor SMESH_MEDMesh_i");
103 //=============================================================================
105 * CORBA: Accessor for Name
107 //=============================================================================
108 char *SMESH_MEDMesh_i::getName() throw(SALOME::SALOME_Exception)
111 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
112 SALOME::INTERNAL_ERROR);
116 // A COMPLETER PAR LE NOM DU MAILLAGE
117 //return CORBA::string_dup(_mesh_i->getName().c_str());
118 return CORBA::string_dup("toto");
122 MESSAGE("Exception en accedant au nom");
123 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
124 SALOME::INTERNAL_ERROR);
128 //=============================================================================
130 * CORBA: Accessor for corbaindex cuisine interne
132 //=============================================================================
133 CORBA::Long SMESH_MEDMesh_i::getCorbaIndex()throw(SALOME::SALOME_Exception)
135 MESSAGE("Non Implemente");
136 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
139 //=============================================================================
141 * CORBA: Accessor for Space Dimension
143 //=============================================================================
144 CORBA::Long SMESH_MEDMesh_i::getSpaceDimension()throw(SALOME::SALOME_Exception)
146 // PN : Il semblerait que la dimension soit fixee a 3
148 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
149 SALOME::INTERNAL_ERROR);
153 //=============================================================================
155 * CORBA: Accessor for Mesh Dimension
157 //=============================================================================
158 CORBA::Long SMESH_MEDMesh_i::getMeshDimension()throw(SALOME::SALOME_Exception)
161 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
162 SALOME::INTERNAL_ERROR);
163 // PN : Il semblerait que la dimension soit fixee a 3
165 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
166 SALOME::INTERNAL_ERROR);
169 //=============================================================================
171 * CORBA: Accessor for the boolean _isAGrid
173 //=============================================================================
174 CORBA::Boolean SMESH_MEDMesh_i::getIsAGrid() throw (SALOME::SALOME_Exception)
176 MESSAGE("!!!!!! NOT YET IMPLEMENTED !!!!!!");
178 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
182 //=============================================================================
184 * CORBA: Accessor for the connectivities, to see if they exist
186 //=============================================================================
188 SMESH_MEDMesh_i::existConnectivity(SALOME_MED::medConnectivity connectivityType,
189 SALOME_MED::medEntityMesh entity)
190 throw (SALOME::SALOME_Exception)
192 MESSAGE("!!!!!! IMPLEMENTED BUT ONLY PARTIALLY !!!!!!");
198 //=============================================================================
200 * CORBA: Accessor for Coordinate
202 //=============================================================================
203 CORBA::Double SMESH_MEDMesh_i::getCoordinate(CORBA::Long Number, CORBA::Long Axis)
204 throw (SALOME::SALOME_Exception)
206 MESSAGE("!!!!!! NOT YET IMPLEMENTED !!!!");
208 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
212 //=============================================================================
214 * CORBA: Accessor for Coordinates System
216 //=============================================================================
217 char *SMESH_MEDMesh_i::getCoordinatesSystem() throw(SALOME::SALOME_Exception)
220 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
221 SALOME::INTERNAL_ERROR);
222 // PN : En dur. Non encore prevu
225 string systcoo = "CARTESIEN";
226 return CORBA::string_dup(systcoo.c_str());
230 MESSAGE("Exception en accedant au maillage");
231 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
232 SALOME::INTERNAL_ERROR);
236 //=============================================================================
238 * CORBA: Accessor for Coordinates
240 //=============================================================================
241 SALOME_MED::double_array * SMESH_MEDMesh_i::getCoordinates(
242 SALOME_MED::medModeSwitch typeSwitch) throw(SALOME::SALOME_Exception)
245 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
246 SALOME::INTERNAL_ERROR);
247 SALOME_MED::double_array_var myseq = new SALOME_MED::double_array;
251 int spaceDimension = 3;
252 int nbNodes = _meshDS->NbNodes();
254 myseq->length(nbNodes * spaceDimension);
257 SMDS_Iterator<const SMDS_MeshNode *> * itNodes=_meshDS->nodesIterator();
258 while(itNodes->more())
260 const SMDS_MeshNode* node = itNodes->next();
262 if (typeSwitch == SALOME_MED::MED_FULL_INTERLACE)
264 myseq[i * 3] = node->X();
265 myseq[i * 3 + 1] = node->Y();
266 myseq[i * 3 + 2] = node->Z();
267 SCRUTE(myseq[i * 3]);
268 SCRUTE(myseq[i * 3 + 1]);
269 SCRUTE(myseq[i * 3 + 2]);
273 ASSERT(typeSwitch == SALOME_MED::MED_NO_INTERLACE);
274 myseq[i] = node->X();
275 myseq[i + nbNodes] = node->Y();
276 myseq[i + (nbNodes * 2)] = node->Z();
278 SCRUTE(myseq[i + nbNodes]);
279 SCRUTE(myseq[i + (nbNodes * 2)]);
287 MESSAGE("Exception en accedant aux coordonnees");
288 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
289 SALOME::INTERNAL_ERROR);
291 return myseq._retn();
294 //=============================================================================
296 * CORBA: Accessor for Coordinates Names
298 //=============================================================================
299 SALOME_MED::string_array *
300 SMESH_MEDMesh_i::getCoordinatesNames()throw(SALOME::SALOME_Exception)
303 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
304 SALOME::INTERNAL_ERROR);
305 SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
309 int spaceDimension = 3;
310 myseq->length(spaceDimension);
311 myseq[0] = CORBA::string_dup("x");
312 myseq[1] = CORBA::string_dup("y");
313 myseq[2] = CORBA::string_dup("z");
317 MESSAGE("Exception en accedant aux noms des coordonnees");
318 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
319 SALOME::INTERNAL_ERROR);
321 return myseq._retn();
325 //=============================================================================
327 * CORBA: Accessor for Coordinates Units
329 //=============================================================================
330 SALOME_MED::string_array *
331 SMESH_MEDMesh_i::getCoordinatesUnits()throw(SALOME::SALOME_Exception)
334 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
335 SALOME::INTERNAL_ERROR);
336 SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
340 int spaceDimension = 3;
341 myseq->length(spaceDimension);
342 myseq[0] = CORBA::string_dup("m");
343 myseq[1] = CORBA::string_dup("m");
344 myseq[2] = CORBA::string_dup("m");
348 MESSAGE("Exception en accedant aux unites des coordonnees");
349 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
350 SALOME::INTERNAL_ERROR);
352 return myseq._retn();
355 //=============================================================================
357 * CORBA: Accessor for Number of Nodes
359 //=============================================================================
360 CORBA::Long SMESH_MEDMesh_i::getNumberOfNodes()throw(SALOME::SALOME_Exception)
363 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
364 SALOME::INTERNAL_ERROR);
367 return _meshDS->NbNodes();
371 MESSAGE("Exception en accedant au nombre de noeuds");
372 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
373 SALOME::INTERNAL_ERROR);
377 //=============================================================================
379 * CORBA: Accessor for number of Types
381 //=============================================================================
382 CORBA::Long SMESH_MEDMesh_i::getNumberOfTypes(SALOME_MED::medEntityMesh entity)
383 throw(SALOME::SALOME_Exception)
386 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
387 SALOME::INTERNAL_ERROR);
393 if (_mapNbTypes.find(entity) != _mapNbTypes.end())
394 retour = _mapNbTypes[entity];
399 MESSAGE("Exception en accedant au nombre de Types");
400 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
401 SALOME::INTERNAL_ERROR);
405 //=============================================================================
407 * CORBA: Accessor for existing geometry element types
408 * Not implemented for MED_ALL_ENTITIES
410 //=============================================================================
411 SALOME_MED::medGeometryElement_array *
412 SMESH_MEDMesh_i::getTypes(SALOME_MED::medEntityMesh entity) throw(SALOME::
416 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
417 SALOME::INTERNAL_ERROR);
418 if (entity == SALOME_MED::MED_ALL_ENTITIES)
419 THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ENTITIES",
423 SALOME_MED::medGeometryElement_array_var myseq =
424 new SALOME_MED::medGeometryElement_array;
427 if (_mapNbTypes.find(entity) == _mapNbTypes.end())
428 THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh",
430 int nbTypes = _mapNbTypes[entity];
432 myseq->length(nbTypes);
434 if (_mapIndToVectTypes.find(entity) == _mapIndToVectTypes.end())
435 THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh",
436 SALOME::INTERNAL_ERROR);
438 int index = _mapIndToVectTypes[entity];
439 ASSERT(_TypesId[index].size() != 0);
441 vector < SALOME_MED::medGeometryElement >::iterator it;
442 for (it = _TypesId[index].begin(); it != _TypesId[index].end(); it++)
449 MESSAGE("Exception en accedant aux differents types");
450 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
451 SALOME::INTERNAL_ERROR);
453 return myseq._retn();
456 //=============================================================================
458 * CORBA: Returns number of elements of type medGeometryElement
459 * Not implemented for MED_ALL_ELEMENTS
460 * implemented for MED_ALL_ENTITIES
462 * Dans cette implementation, il n est pas prevu de tenir compte du entity
463 * qui ne doit pas pouvoir avoir deux valeurs differentes pour un geomElement
465 //=============================================================================
466 CORBA::Long SMESH_MEDMesh_i::getNumberOfElements(SALOME_MED::
467 medEntityMesh entity,
468 SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
471 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
472 SALOME::INTERNAL_ERROR);
473 if (geomElement == SALOME_MED::MED_ALL_ELEMENTS)
474 THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ELEMENTS",
482 if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end())
484 int index = _mapIndToSeqElts[geomElement];
486 retour = _seq_elemId[index]->length();
492 MESSAGE("Exception en accedant au nombre d élements");
493 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
494 SALOME::INTERNAL_ERROR);
498 //=============================================================================
500 * CORBA: Accessor for connectivities
502 //=============================================================================
503 SALOME_MED::long_array *
504 SMESH_MEDMesh_i::getConnectivity(SALOME_MED::medModeSwitch typeSwitch,
505 SALOME_MED::medConnectivity mode,
506 SALOME_MED::medEntityMesh entity,
507 SALOME_MED::medGeometryElement geomElement)
508 throw(SALOME::SALOME_Exception)
511 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
512 SALOME::INTERNAL_ERROR);
513 if (mode != SALOME_MED::MED_NODAL)
514 THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
515 if (typeSwitch == SALOME_MED::MED_NO_INTERLACE)
516 THROW_SALOME_CORBA_EXCEPTION("Not Yet Implemented", SALOME::BAD_PARAM);
520 // Faut-il renvoyer un pointeur vide ???
521 if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end())
522 THROW_SALOME_CORBA_EXCEPTION("No Such Element in the mesh",
525 int index = _mapIndToSeqElts[geomElement];
527 return _seq_elemId[index]._retn();
530 //=============================================================================
532 * CORBA: Accessor for connectivities
534 //=============================================================================
535 SALOME_MED::long_array *
536 SMESH_MEDMesh_i::getConnectivityIndex(SALOME_MED::medConnectivity mode,
537 SALOME_MED::medEntityMesh entity)
538 throw(SALOME::SALOME_Exception)
540 MESSAGE("Pas Implemente dans SMESH");
541 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
545 //=============================================================================
547 * CORBA: Find an element corresponding to the given connectivity
549 //=============================================================================
551 SMESH_MEDMesh_i::getElementNumber(SALOME_MED::medConnectivity mode,
552 SALOME_MED::medEntityMesh entity,
553 SALOME_MED::medGeometryElement type,
554 const SALOME_MED::long_array & connectivity)
555 throw(SALOME::SALOME_Exception)
557 const char *LOC = "getElementNumber ";
558 MESSAGE(LOC << "Pas Implemente dans SMESH");
559 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
563 //=============================================================================
565 * CORBA: Accessor for Ascendant connectivities
566 * not implemented for MED_ALL_ENTITIES and MED_MAILLE
568 //=============================================================================
569 SALOME_MED::long_array *
570 SMESH_MEDMesh_i::getReverseConnectivity(SALOME_MED::
571 medConnectivity mode) throw(SALOME::SALOME_Exception)
573 MESSAGE("Pas Implemente dans SMESH");
574 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
578 //=============================================================================
580 * CORBA: Accessor for connectivities
582 //=============================================================================
583 SALOME_MED::long_array *
584 SMESH_MEDMesh_i::getReverseConnectivityIndex(SALOME_MED::
585 medConnectivity mode) throw(SALOME::SALOME_Exception)
587 MESSAGE("Pas Implemente dans SMESH");
588 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
592 //=============================================================================
594 * CORBA: Returns number of families within the mesh
596 //=============================================================================
597 CORBA::Long SMESH_MEDMesh_i::getNumberOfFamilies(SALOME_MED::
598 medEntityMesh entity) throw(SALOME::SALOME_Exception)
600 if (_creeFamily == false)
603 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
604 SALOME::INTERNAL_ERROR);
605 return _families.size();
608 //=============================================================================
610 * CORBA: Returns number of groups within the mesh
612 //=============================================================================
613 CORBA::Long SMESH_MEDMesh_i::getNumberOfGroups(SALOME_MED::medEntityMesh entity)
614 throw(SALOME::SALOME_Exception)
617 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
618 SALOME::INTERNAL_ERROR);
619 MESSAGE(" Pas d implementation des groupes dans SMESH");
623 //=============================================================================
625 * CORBA: Returns references for families within the mesh
627 //=============================================================================
628 SALOME_MED::Family_array *
629 SMESH_MEDMesh_i::getFamilies(SALOME_MED::
630 medEntityMesh entity) throw(SALOME::SALOME_Exception)
632 if (_creeFamily == false)
635 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
636 SALOME::INTERNAL_ERROR);
637 SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array;
638 int nbfam = _families.size();
639 myseq->length(nbfam);
641 vector < SALOME_MED::FAMILY_ptr >::iterator it;
642 for (it = _families.begin(); it != _families.end(); it++)
646 return myseq._retn();
649 //=============================================================================
651 * CORBA: Returns references for family i within the mesh
653 //=============================================================================
654 SALOME_MED::FAMILY_ptr SMESH_MEDMesh_i::getFamily(SALOME_MED::
655 medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception)
657 if (_creeFamily == false)
660 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
661 SALOME::INTERNAL_ERROR);
663 SCRUTE(_families[i]->getName());
664 MESSAGE(" SMESH_MEDMesh_i::getFamily " << i) return _families[i];
667 //=============================================================================
669 * CORBA: Returns references for groups within the mesh
671 //=============================================================================
672 SALOME_MED::Group_array *
673 SMESH_MEDMesh_i::getGroups(SALOME_MED::medEntityMesh entity) throw(SALOME::
677 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
678 SALOME::INTERNAL_ERROR);
679 MESSAGE(" Pas d implementation des groupes dans SMESH");
680 THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
683 //=============================================================================
685 * CORBA: Returns references for group i within the mesh
687 //=============================================================================
688 SALOME_MED::GROUP_ptr SMESH_MEDMesh_i::getGroup(SALOME_MED::
689 medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception)
692 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
693 SALOME::INTERNAL_ERROR);
694 MESSAGE(" Pas d implementation des groupes dans SMESH");
695 THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
697 //=============================================================================
699 * CORBA: Returns references for the global numbering index
701 //=============================================================================
702 SALOME_MED::long_array*
703 SMESH_MEDMesh_i::getGlobalNumberingIndex(SALOME_MED::medEntityMesh entity)
704 throw (SALOME::SALOME_Exception)
706 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
708 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
712 //=============================================================================
714 * CORBA: Returns references for the support of boundary elements of type
717 //=============================================================================
718 SALOME_MED::SUPPORT_ptr
719 SMESH_MEDMesh_i::getBoundaryElements(SALOME_MED::medEntityMesh entity)
720 throw (SALOME::SALOME_Exception)
722 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
724 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
728 //=============================================================================
730 * CORBA: Returns references for the support of the skin of the support
733 //=============================================================================
734 SALOME_MED::SUPPORT_ptr
735 SMESH_MEDMesh_i::getSkin(SALOME_MED::SUPPORT_ptr mySupport3D)
736 throw (SALOME::SALOME_Exception)
738 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
740 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
744 //=============================================================================
748 //=============================================================================
749 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getVolume(SALOME_MED::
750 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
752 MESSAGE("Pas Implemente dans SMESH");
753 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
757 //=============================================================================
761 //=============================================================================
762 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getArea(SALOME_MED::
763 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
765 MESSAGE("Pas Implemente dans SMESH");
766 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
770 //=============================================================================
774 //=============================================================================
775 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getLength(SALOME_MED::
776 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
778 MESSAGE("Pas Implemente dans SMESH");
779 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
783 //=============================================================================
787 //=============================================================================
788 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNormal(SALOME_MED::
789 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
791 MESSAGE("Pas Implemente dans SMESH");
792 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
796 //=============================================================================
800 //=============================================================================
801 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getBarycenter(SALOME_MED::
802 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
804 MESSAGE("Pas Implemente dans SMESH");
805 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
809 //=============================================================================
813 //=============================================================================
814 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNeighbourhood(SALOME_MED::
815 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
817 MESSAGE("Non Implemente");
818 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
822 //=============================================================================
824 * CORBA: add the Mesh in the StudyManager
827 //=============================================================================
828 void SMESH_MEDMesh_i::addInStudy(SALOMEDS::Study_ptr myStudy,
829 SALOME_MED::MESH_ptr myIor) throw(SALOME::SALOME_Exception)
831 BEGIN_OF("MED_Mesh_i::addInStudy");
834 MESSAGE("Mesh already in Study");
835 THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study",
840 * SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
842 * // Create SComponent labelled 'MED' if it doesn't already exit
843 * SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
844 * if ( CORBA::is_nil(medfather) )
846 * MESSAGE("Add Component MED");
847 * medfather = myBuilder->NewComponent("MED");
848 * //myBuilder->AddAttribute (medfather,SALOMEDS::Name,"MED");
849 * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
850 * myBuilder->FindOrCreateAttribute(medfather, "AttributeName"));
851 * aName->SetValue("MED");
853 * myBuilder->DefineComponentInstance(medfather,myIor);
857 * MESSAGE("Add a mesh Object under MED");
858 * myBuilder->NewCommand();
859 * SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfather);
861 * ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
862 * ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
863 * CORBA::ORB_var &orb = init(0,0);
864 * string iorStr = orb->object_to_string(myIor);
865 * //myBuilder->AddAttribute(newObj,SALOMEDS::IOR,iorStr.c_str());
866 * SALOMEDS::AttributeIOR_var aIOR = SALOMEDS::AttributeIOR::_narrow(
867 * myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"));
868 * aIOR->SetValue(iorStr.c_str());
870 * //myBuilder->AddAttribute(newObj,SALOMEDS::Name,_mesh_i->getName().c_str());
871 * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
872 * myBuilder->FindOrCreateAttribute(newObj, "AttributeName"));
873 * aName->SetValue(_mesh_i->getName().c_str());
875 * _meshId = newObj->GetID();
876 * myBuilder->CommitCommand();
879 END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
882 //=============================================================================
884 * CORBA: write mesh in a med file
886 //=============================================================================
887 void SMESH_MEDMesh_i::write(CORBA::Long i, const char *driverMeshName)
888 throw(SALOME::SALOME_Exception)
890 MESSAGE("Non Implemente");
891 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
894 //=============================================================================
896 * CORBA: read mesh in a med file
898 //=============================================================================
899 void SMESH_MEDMesh_i::read(CORBA::Long i) throw(SALOME::SALOME_Exception)
901 MESSAGE("Non Implemente");
902 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
905 //=============================================================================
907 * CORBA : release driver
909 //=============================================================================
910 void SMESH_MEDMesh_i::rmDriver(CORBA::Long i) throw(SALOME::SALOME_Exception)
912 MESSAGE("Non Implemente");
913 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
916 //=============================================================================
918 * CORBA : attach driver
920 //=============================================================================
921 CORBA::Long SMESH_MEDMesh_i::addDriver(SALOME_MED::medDriverTypes driverType,
922 const char *fileName, const char *meshName) throw(SALOME::SALOME_Exception)
924 MESSAGE("Non Implemente");
925 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
929 //=============================================================================
931 * Calcule le Nb d'elements par entite geometrique
933 //=============================================================================
934 void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception)
940 _mapNbTypes[SALOME_MED::MED_NODE] = 1;
941 // On compte les aretes MED_SEG2 ou MED_SEG3
942 // On range les elements dans les vecteurs correspondants
944 _mapIndToSeqElts[SALOME_MED::MED_SEG2] = _indexElts++;
945 _mapIndToSeqElts[SALOME_MED::MED_SEG3] = _indexElts++;
946 _mapIndToVectTypes[SALOME_MED::MED_EDGE] = _indexEnts++;
950 SALOME_MED::medGeometryElement medElement;
952 SMDS_Iterator<const SMDS_MeshEdge*> * itEdges=_meshDS->edgesIterator();
953 while(itEdges->more())
955 const SMDS_MeshEdge* elem = itEdges->next();
956 int nb_of_nodes = elem->NbNodes();
962 medElement = SALOME_MED::MED_SEG2;
966 _TypesId[SALOME_MED::MED_EDGE].
967 push_back(SALOME_MED::MED_SEG2);
973 medElement = SALOME_MED::MED_SEG3;
977 _TypesId[SALOME_MED::MED_EDGE].
978 push_back(SALOME_MED::MED_SEG3);
983 int index = _mapIndToSeqElts[medElement];
985 // Traitement de l arete
987 int longueur = _seq_elemId[index]->length();
988 _seq_elemId[index]->length(longueur + nb_of_nodes);
990 SMDS_Iterator<const SMDS_MeshNode*> * itn=_meshDS->nodesIterator();
992 for(int k=0; itn->more(); k++)
993 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
998 _mapNbTypes[SALOME_MED::MED_EDGE] = trouveSeg2 + trouveSeg3;
1000 // On compte les faces MED_TRIA3, MED_HEXA8, MED_TRIA6
1001 // On range les elements dans les vecteurs correspondants
1002 int trouveTria3 = 0;
1003 int trouveTria6 = 0;
1004 int trouveQuad4 = 0;
1006 _mapIndToSeqElts[SALOME_MED::MED_TRIA3] = _indexElts++;
1007 _mapIndToSeqElts[SALOME_MED::MED_TRIA6] = _indexElts++;
1008 _mapIndToSeqElts[SALOME_MED::MED_QUAD4] = _indexElts++;
1009 _mapIndToVectTypes[SALOME_MED::MED_FACE] = _indexEnts++;
1011 SMDS_Iterator<const SMDS_MeshFace*> * itFaces=_meshDS->facesIterator();
1012 while(itFaces->more())
1014 const SMDS_MeshFace * elem = itFaces->next();
1015 int nb_of_nodes = elem->NbNodes();
1017 switch (nb_of_nodes)
1021 medElement = SALOME_MED::MED_TRIA3;
1022 if (trouveTria3 == 0)
1025 _TypesId[SALOME_MED::MED_FACE].
1026 push_back(SALOME_MED::MED_TRIA3);
1032 medElement = SALOME_MED::MED_QUAD4;
1033 if (trouveQuad4 == 0)
1036 _TypesId[SALOME_MED::MED_FACE].
1037 push_back(SALOME_MED::MED_QUAD4);
1043 medElement = SALOME_MED::MED_TRIA6;
1044 if (trouveTria6 == 0)
1047 _TypesId[SALOME_MED::MED_FACE].
1048 push_back(SALOME_MED::MED_TRIA6);
1053 int index = _mapIndToSeqElts[medElement];
1056 // Traitement de la face
1057 // Attention La numérotation des noeuds Med commence a 1
1059 int longueur = _seq_elemId[index]->length();
1060 _seq_elemId[index]->length(longueur + nb_of_nodes);
1062 SMDS_Iterator<const SMDS_MeshNode*> * itn=_meshDS->nodesIterator();
1064 for(int k=0; itn->more(); k++)
1065 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
1070 _mapNbTypes[SALOME_MED::MED_FACE] =
1071 trouveTria3 + trouveTria6 + trouveQuad4;
1073 _mapIndToSeqElts[SALOME_MED::MED_HEXA8] = _indexElts++;
1074 _mapIndToVectTypes[SALOME_MED::MED_CELL] = _indexEnts++;
1075 int index = _mapIndToSeqElts[medElement];
1077 int trouveHexa8 = 0;
1079 SMDS_Iterator<const SMDS_MeshVolume*> * itVolumes=_meshDS->volumesIterator();
1080 while(itVolumes->more())
1082 const SMDS_MeshVolume * elem = itVolumes->next();
1084 int nb_of_nodes = elem->NbNodes();
1085 medElement = SALOME_MED::MED_HEXA8;
1086 ASSERT(nb_of_nodes = 8);
1088 if (trouveHexa8 == 0)
1091 _TypesId[SALOME_MED::MED_CELL].push_back(SALOME_MED::MED_HEXA8);
1093 // Traitement de la maille
1094 int longueur = _seq_elemId[index]->length();
1095 _seq_elemId[index]->length(longueur + nb_of_nodes);
1097 SMDS_Iterator<const SMDS_MeshNode*> * itn=_meshDS->nodesIterator();
1098 for(int k=0; itn->more(); k++)
1099 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
1104 _mapNbTypes[SALOME_MED::MED_CELL] = trouveHexa8;
1105 _mapNbTypes[SALOME_MED::MED_ALL_ENTITIES]
1107 trouveHexa8 + trouveTria3 + trouveTria6 + trouveQuad4 + trouveSeg2 +
1112 //=============================================================================
1114 * Creation des familles
1116 //=============================================================================
1117 void SMESH_MEDMesh_i::createFamilies() throw(SALOME::SALOME_Exception)
1119 string famDes = ("Je ne sais pas");
1120 string famName0 = "Famille_";
1124 if (_creeFamily == false)
1127 SMESH_subMesh_i *subMeshServant;
1129 map < int, SMESH_subMesh_i * >::iterator it;
1130 for (it = _mesh_i->_mapSubMesh_i.begin();
1131 it != _mesh_i->_mapSubMesh_i.end(); it++)
1133 SMESH_subMesh_i *submesh_i = (*it).second;
1134 int famIdent = (*it).first;
1136 ASSERT(famIdent < 999999999);
1137 sprintf(numero, "%d\n", famIdent);
1138 famName = famName0 + numero;
1140 SMESH_MEDFamily_i *famservant =
1141 new SMESH_MEDFamily_i(famIdent, submesh_i,
1142 famName, famDes, SALOME_MED::MED_NODE);
1143 SALOME_MED::FAMILY_ptr famille =
1144 SALOME_MED::FAMILY::_narrow(famservant->
1145 POA_SALOME_MED::FAMILY::_this());
1146 _families.push_back(famille);
1150 //=============================================================================
1152 * Gives informations of the considered mesh.
1154 //=============================================================================
1155 SALOME_MED::MESH::meshInfos * SMESH_MEDMesh_i::getMeshGlobal()
1156 throw (SALOME::SALOME_Exception)
1158 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1160 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1164 //=============================================================================
1166 * Gives informations on coordinates of the considered mesh.
1168 //=============================================================================
1169 SALOME_MED::MESH::coordinateInfos * SMESH_MEDMesh_i::getCoordGlobal()
1170 throw (SALOME::SALOME_Exception)
1172 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1174 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1178 //=============================================================================
1180 * Gives informations on connectivities of the considered mesh for the entity
1183 //=============================================================================
1184 SALOME_MED::MESH::connectivityInfos *
1185 SMESH_MEDMesh_i::getConnectGlobal(SALOME_MED::medEntityMesh entity)
1186 throw (SALOME::SALOME_Exception)
1188 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1190 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1194 //=============================================================================
1196 * Gives the type of the element number of entity entity
1198 //=============================================================================
1199 SALOME_MED::medGeometryElement
1200 SMESH_MEDMesh_i::getElementType(SALOME_MED::medEntityMesh entity,
1202 throw (SALOME::SALOME_Exception)
1204 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1206 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1208 return (SALOME_MED::medGeometryElement) 0;