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
27 #include "SMESH_MEDMesh_i.hxx"
28 #include "SMESH_Mesh_i.hxx"
30 #include "SMESHDS_Mesh.hxx"
31 #include "SMESHDS_SubMesh.hxx"
34 #include <TopExp_Explorer.hxx>
36 #include <TopoDS_Iterator.hxx>
37 #include <TopoDS_Compound.hxx>
38 #include <TopoDS_CompSolid.hxx>
39 #include <TopoDS_Solid.hxx>
40 #include <TopoDS_Shell.hxx>
41 #include <TopoDS_Face.hxx>
42 #include <TopoDS_Wire.hxx>
43 #include <TopoDS_Edge.hxx>
44 #include <TopoDS_Vertex.hxx>
45 #include <TopoDS_Shape.hxx>
46 #include <TopTools_MapOfShape.hxx>
48 #include "utilities.h"
49 #include "Utils_CorbaException.hxx"
51 #include "SMESH_MEDSupport_i.hxx"
52 #include "SMESH_MEDFamily_i.hxx"
54 # include "Utils_ORB_INIT.hxx"
55 # include "Utils_SINGLETON.hxx"
56 # include "Utils_ExceptHandlers.hxx"
65 //=============================================================================
69 //=============================================================================
70 // PN Est-ce un const ?
71 SMESH_MEDMesh_i::SMESH_MEDMesh_i()
73 BEGIN_OF("Default Constructor SMESH_MEDMesh_i");
74 END_OF("Default Constructor SMESH_MEDMesh_i");
77 //=============================================================================
81 //=============================================================================
82 SMESH_MEDMesh_i::~SMESH_MEDMesh_i()
86 //=============================================================================
90 //=============================================================================
91 SMESH_MEDMesh_i::SMESH_MEDMesh_i(::SMESH_Mesh_i * m_i):_meshId(""),
98 BEGIN_OF("Constructor SMESH_MEDMesh_i");
101 _meshDS = _mesh_i->GetImpl().GetMeshDS();
103 END_OF("Constructor SMESH_MEDMesh_i");
106 //=============================================================================
108 * CORBA: Accessor for Name
110 //=============================================================================
111 char *SMESH_MEDMesh_i::getName() throw(SALOME::SALOME_Exception)
114 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
115 SALOME::INTERNAL_ERROR);
119 // A COMPLETER PAR LE NOM DU MAILLAGE
120 //return CORBA::string_dup(_mesh_i->getName().c_str());
121 return CORBA::string_dup("toto");
125 MESSAGE("Exception en accedant au nom");
126 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
127 SALOME::INTERNAL_ERROR);
131 //=============================================================================
133 * CORBA: Accessor for corbaindex cuisine interne
135 //=============================================================================
136 CORBA::Long SMESH_MEDMesh_i::getCorbaIndex()throw(SALOME::SALOME_Exception)
138 MESSAGE("Non Implemente");
139 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
142 //=============================================================================
144 * CORBA: Accessor for Space Dimension
146 //=============================================================================
147 CORBA::Long SMESH_MEDMesh_i::getSpaceDimension()throw(SALOME::SALOME_Exception)
149 // PN : Il semblerait que la dimension soit fixee a 3
151 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
152 SALOME::INTERNAL_ERROR);
156 //=============================================================================
158 * CORBA: Accessor for Mesh Dimension
160 //=============================================================================
161 CORBA::Long SMESH_MEDMesh_i::getMeshDimension()throw(SALOME::SALOME_Exception)
164 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
165 SALOME::INTERNAL_ERROR);
166 // PN : Il semblerait que la dimension soit fixee a 3
168 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
169 SALOME::INTERNAL_ERROR);
172 //=============================================================================
174 * CORBA: Accessor for the boolean _isAGrid
176 //=============================================================================
177 CORBA::Boolean SMESH_MEDMesh_i::getIsAGrid() throw (SALOME::SALOME_Exception)
179 MESSAGE("!!!!!! NOT YET IMPLEMENTED !!!!!!");
181 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
185 //=============================================================================
187 * CORBA: Accessor for the connectivities, to see if they exist
189 //=============================================================================
191 SMESH_MEDMesh_i::existConnectivity(SALOME_MED::medConnectivity connectivityType,
192 SALOME_MED::medEntityMesh entity)
193 throw (SALOME::SALOME_Exception)
195 MESSAGE("!!!!!! IMPLEMENTED BUT ONLY PARTIALLY !!!!!!");
201 //=============================================================================
203 * CORBA: Accessor for Coordinate
205 //=============================================================================
206 CORBA::Double SMESH_MEDMesh_i::getCoordinate(CORBA::Long Number, CORBA::Long Axis)
207 throw (SALOME::SALOME_Exception)
209 MESSAGE("!!!!!! NOT YET IMPLEMENTED !!!!");
211 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
215 //=============================================================================
217 * CORBA: Accessor for Coordinates System
219 //=============================================================================
220 char *SMESH_MEDMesh_i::getCoordinatesSystem() throw(SALOME::SALOME_Exception)
223 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
224 SALOME::INTERNAL_ERROR);
225 // PN : En dur. Non encore prevu
228 string systcoo = "CARTESIEN";
229 return CORBA::string_dup(systcoo.c_str());
233 MESSAGE("Exception en accedant au maillage");
234 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
235 SALOME::INTERNAL_ERROR);
239 //=============================================================================
241 * CORBA: Accessor for Coordinates
243 //=============================================================================
244 SALOME_MED::double_array * SMESH_MEDMesh_i::getCoordinates(
245 SALOME_MED::medModeSwitch typeSwitch) throw(SALOME::SALOME_Exception)
248 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
249 SALOME::INTERNAL_ERROR);
250 SALOME_MED::double_array_var myseq = new SALOME_MED::double_array;
254 int spaceDimension = 3;
255 int nbNodes = _meshDS->NbNodes();
257 myseq->length(nbNodes * spaceDimension);
260 SMDS_NodeIteratorPtr itNodes=_meshDS->nodesIterator();
261 while(itNodes->more())
263 const SMDS_MeshNode* node = itNodes->next();
265 if (typeSwitch == SALOME_MED::MED_FULL_INTERLACE)
267 myseq[i * 3] = node->X();
268 myseq[i * 3 + 1] = node->Y();
269 myseq[i * 3 + 2] = node->Z();
270 SCRUTE(myseq[i * 3]);
271 SCRUTE(myseq[i * 3 + 1]);
272 SCRUTE(myseq[i * 3 + 2]);
276 ASSERT(typeSwitch == SALOME_MED::MED_NO_INTERLACE);
277 myseq[i] = node->X();
278 myseq[i + nbNodes] = node->Y();
279 myseq[i + (nbNodes * 2)] = node->Z();
281 SCRUTE(myseq[i + nbNodes]);
282 SCRUTE(myseq[i + (nbNodes * 2)]);
289 MESSAGE("Exception en accedant aux coordonnees");
290 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
291 SALOME::INTERNAL_ERROR);
293 return myseq._retn();
296 //=============================================================================
298 * CORBA: Accessor for Coordinates Names
300 //=============================================================================
301 SALOME_MED::string_array *
302 SMESH_MEDMesh_i::getCoordinatesNames()throw(SALOME::SALOME_Exception)
305 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
306 SALOME::INTERNAL_ERROR);
307 SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
311 int spaceDimension = 3;
312 myseq->length(spaceDimension);
313 myseq[0] = CORBA::string_dup("x");
314 myseq[1] = CORBA::string_dup("y");
315 myseq[2] = CORBA::string_dup("z");
319 MESSAGE("Exception en accedant aux noms des coordonnees");
320 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
321 SALOME::INTERNAL_ERROR);
323 return myseq._retn();
327 //=============================================================================
329 * CORBA: Accessor for Coordinates Units
331 //=============================================================================
332 SALOME_MED::string_array *
333 SMESH_MEDMesh_i::getCoordinatesUnits()throw(SALOME::SALOME_Exception)
336 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
337 SALOME::INTERNAL_ERROR);
338 SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
342 int spaceDimension = 3;
343 myseq->length(spaceDimension);
344 myseq[0] = CORBA::string_dup("m");
345 myseq[1] = CORBA::string_dup("m");
346 myseq[2] = CORBA::string_dup("m");
350 MESSAGE("Exception en accedant aux unites des coordonnees");
351 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
352 SALOME::INTERNAL_ERROR);
354 return myseq._retn();
357 //=============================================================================
359 * CORBA: Accessor for Number of Nodes
361 //=============================================================================
362 CORBA::Long SMESH_MEDMesh_i::getNumberOfNodes()throw(SALOME::SALOME_Exception)
365 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
366 SALOME::INTERNAL_ERROR);
369 return _meshDS->NbNodes();
373 MESSAGE("Exception en accedant au nombre de noeuds");
374 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
375 SALOME::INTERNAL_ERROR);
379 //=============================================================================
381 * CORBA: Accessor for number of Types
383 //=============================================================================
384 CORBA::Long SMESH_MEDMesh_i::getNumberOfTypes(SALOME_MED::medEntityMesh entity)
385 throw(SALOME::SALOME_Exception)
388 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
389 SALOME::INTERNAL_ERROR);
395 if (_mapNbTypes.find(entity) != _mapNbTypes.end())
396 retour = _mapNbTypes[entity];
401 MESSAGE("Exception en accedant au nombre de Types");
402 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
403 SALOME::INTERNAL_ERROR);
407 //=============================================================================
409 * CORBA: Accessor for existing geometry element types
410 * Not implemented for MED_ALL_ENTITIES
412 //=============================================================================
413 SALOME_MED::medGeometryElement_array *
414 SMESH_MEDMesh_i::getTypes(SALOME_MED::medEntityMesh entity) throw(SALOME::
418 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
419 SALOME::INTERNAL_ERROR);
420 if (entity == SALOME_MED::MED_ALL_ENTITIES)
421 THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ENTITIES",
425 SALOME_MED::medGeometryElement_array_var myseq =
426 new SALOME_MED::medGeometryElement_array;
429 if (_mapNbTypes.find(entity) == _mapNbTypes.end())
430 THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh",
432 int nbTypes = _mapNbTypes[entity];
434 myseq->length(nbTypes);
436 if (_mapIndToVectTypes.find(entity) == _mapIndToVectTypes.end())
437 THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh",
438 SALOME::INTERNAL_ERROR);
440 int index = _mapIndToVectTypes[entity];
441 ASSERT(_TypesId[index].size() != 0);
443 vector < SALOME_MED::medGeometryElement >::iterator it;
444 for (it = _TypesId[index].begin(); it != _TypesId[index].end(); it++)
451 MESSAGE("Exception en accedant aux differents types");
452 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
453 SALOME::INTERNAL_ERROR);
455 return myseq._retn();
458 //=============================================================================
460 * CORBA: Returns number of elements of type medGeometryElement
461 * Not implemented for MED_ALL_ELEMENTS
462 * implemented for MED_ALL_ENTITIES
464 * Dans cette implementation, il n est pas prevu de tenir compte du entity
465 * qui ne doit pas pouvoir avoir deux valeurs differentes pour un geomElement
467 //=============================================================================
468 CORBA::Long SMESH_MEDMesh_i::getNumberOfElements(SALOME_MED::
469 medEntityMesh entity,
470 SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
473 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
474 SALOME::INTERNAL_ERROR);
475 if (geomElement == SALOME_MED::MED_ALL_ELEMENTS)
476 THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ELEMENTS",
484 if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end())
486 int index = _mapIndToSeqElts[geomElement];
488 retour = _seq_elemId[index]->length();
494 MESSAGE("Exception en accedant au nombre d élements");
495 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
496 SALOME::INTERNAL_ERROR);
500 //=============================================================================
502 * CORBA: Accessor for connectivities
504 //=============================================================================
505 SALOME_MED::long_array *
506 SMESH_MEDMesh_i::getConnectivity(SALOME_MED::medModeSwitch typeSwitch,
507 SALOME_MED::medConnectivity mode,
508 SALOME_MED::medEntityMesh entity,
509 SALOME_MED::medGeometryElement geomElement)
510 throw(SALOME::SALOME_Exception)
513 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
514 SALOME::INTERNAL_ERROR);
515 if (mode != SALOME_MED::MED_NODAL)
516 THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
517 if (typeSwitch == SALOME_MED::MED_NO_INTERLACE)
518 THROW_SALOME_CORBA_EXCEPTION("Not Yet Implemented", SALOME::BAD_PARAM);
522 // Faut-il renvoyer un pointeur vide ???
523 if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end())
524 THROW_SALOME_CORBA_EXCEPTION("No Such Element in the mesh",
527 int index = _mapIndToSeqElts[geomElement];
529 return _seq_elemId[index]._retn();
532 //=============================================================================
534 * CORBA: Accessor for connectivities
536 //=============================================================================
537 SALOME_MED::long_array *
538 SMESH_MEDMesh_i::getConnectivityIndex(SALOME_MED::medConnectivity mode,
539 SALOME_MED::medEntityMesh entity)
540 throw(SALOME::SALOME_Exception)
542 MESSAGE("Pas Implemente dans SMESH");
543 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
547 //=============================================================================
549 * CORBA: Find an element corresponding to the given connectivity
551 //=============================================================================
553 SMESH_MEDMesh_i::getElementNumber(SALOME_MED::medConnectivity mode,
554 SALOME_MED::medEntityMesh entity,
555 SALOME_MED::medGeometryElement type,
556 const SALOME_MED::long_array & connectivity)
557 throw(SALOME::SALOME_Exception)
559 const char *LOC = "getElementNumber ";
560 MESSAGE(LOC << "Pas Implemente dans SMESH");
561 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
565 //=============================================================================
567 * CORBA: Accessor for Ascendant connectivities
568 * not implemented for MED_ALL_ENTITIES and MED_MAILLE
570 //=============================================================================
571 SALOME_MED::long_array *
572 SMESH_MEDMesh_i::getReverseConnectivity(SALOME_MED::
573 medConnectivity mode) throw(SALOME::SALOME_Exception)
575 MESSAGE("Pas Implemente dans SMESH");
576 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
580 //=============================================================================
582 * CORBA: Accessor for connectivities
584 //=============================================================================
585 SALOME_MED::long_array *
586 SMESH_MEDMesh_i::getReverseConnectivityIndex(SALOME_MED::
587 medConnectivity mode) throw(SALOME::SALOME_Exception)
589 MESSAGE("Pas Implemente dans SMESH");
590 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
594 //=============================================================================
596 * CORBA: Returns number of families within the mesh
598 //=============================================================================
599 CORBA::Long SMESH_MEDMesh_i::getNumberOfFamilies(SALOME_MED::
600 medEntityMesh entity) throw(SALOME::SALOME_Exception)
602 if (_creeFamily == false)
605 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
606 SALOME::INTERNAL_ERROR);
607 return _families.size();
610 //=============================================================================
612 * CORBA: Returns number of groups within the mesh
614 //=============================================================================
615 CORBA::Long SMESH_MEDMesh_i::getNumberOfGroups(SALOME_MED::medEntityMesh entity)
616 throw(SALOME::SALOME_Exception)
619 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
620 SALOME::INTERNAL_ERROR);
621 MESSAGE(" Pas d implementation des groupes dans SMESH");
625 //=============================================================================
627 * CORBA: Returns references for families within the mesh
629 //=============================================================================
630 SALOME_MED::Family_array *
631 SMESH_MEDMesh_i::getFamilies(SALOME_MED::
632 medEntityMesh entity) throw(SALOME::SALOME_Exception)
634 if (_creeFamily == false)
637 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
638 SALOME::INTERNAL_ERROR);
639 SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array;
640 int nbfam = _families.size();
641 myseq->length(nbfam);
643 vector < SALOME_MED::FAMILY_ptr >::iterator it;
644 for (it = _families.begin(); it != _families.end(); it++)
648 return myseq._retn();
651 //=============================================================================
653 * CORBA: Returns references for family i within the mesh
655 //=============================================================================
656 SALOME_MED::FAMILY_ptr SMESH_MEDMesh_i::getFamily(SALOME_MED::
657 medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception)
659 if (_creeFamily == false)
662 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
663 SALOME::INTERNAL_ERROR);
665 SCRUTE(_families[i]->getName());
666 MESSAGE(" SMESH_MEDMesh_i::getFamily " << i) return _families[i];
669 //=============================================================================
671 * CORBA: Returns references for groups within the mesh
673 //=============================================================================
674 SALOME_MED::Group_array *
675 SMESH_MEDMesh_i::getGroups(SALOME_MED::medEntityMesh entity) throw(SALOME::
679 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
680 SALOME::INTERNAL_ERROR);
681 MESSAGE(" Pas d implementation des groupes dans SMESH");
682 THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
685 //=============================================================================
687 * CORBA: Returns references for group i within the mesh
689 //=============================================================================
690 SALOME_MED::GROUP_ptr SMESH_MEDMesh_i::getGroup(SALOME_MED::
691 medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception)
694 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
695 SALOME::INTERNAL_ERROR);
696 MESSAGE(" Pas d implementation des groupes dans SMESH");
697 THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
699 //=============================================================================
701 * CORBA: Returns references for the global numbering index
703 //=============================================================================
704 SALOME_MED::long_array*
705 SMESH_MEDMesh_i::getGlobalNumberingIndex(SALOME_MED::medEntityMesh entity)
706 throw (SALOME::SALOME_Exception)
708 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
710 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
714 //=============================================================================
716 * CORBA: Returns references for the support of boundary elements of type
719 //=============================================================================
720 SALOME_MED::SUPPORT_ptr
721 SMESH_MEDMesh_i::getBoundaryElements(SALOME_MED::medEntityMesh entity)
722 throw (SALOME::SALOME_Exception)
724 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
726 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
730 //=============================================================================
732 * CORBA: Returns references for the support of the skin of the support
735 //=============================================================================
736 SALOME_MED::SUPPORT_ptr
737 SMESH_MEDMesh_i::getSkin(SALOME_MED::SUPPORT_ptr mySupport3D)
738 throw (SALOME::SALOME_Exception)
740 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
742 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
746 //=============================================================================
750 //=============================================================================
751 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getVolume(SALOME_MED::
752 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
754 MESSAGE("Pas Implemente dans SMESH");
755 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
759 //=============================================================================
763 //=============================================================================
764 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getArea(SALOME_MED::
765 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
767 MESSAGE("Pas Implemente dans SMESH");
768 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
772 //=============================================================================
776 //=============================================================================
777 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getLength(SALOME_MED::
778 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
780 MESSAGE("Pas Implemente dans SMESH");
781 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
785 //=============================================================================
789 //=============================================================================
790 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNormal(SALOME_MED::
791 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
793 MESSAGE("Pas Implemente dans SMESH");
794 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
798 //=============================================================================
802 //=============================================================================
803 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getBarycenter(SALOME_MED::
804 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
806 MESSAGE("Pas Implemente dans SMESH");
807 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
811 //=============================================================================
815 //=============================================================================
816 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNeighbourhood(SALOME_MED::
817 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
819 MESSAGE("Non Implemente");
820 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
824 //=============================================================================
826 * CORBA: add the Mesh in the StudyManager
829 //=============================================================================
830 void SMESH_MEDMesh_i::addInStudy(SALOMEDS::Study_ptr myStudy,
831 SALOME_MED::MESH_ptr myIor) throw(SALOME::SALOME_Exception)
833 BEGIN_OF("MED_Mesh_i::addInStudy");
836 MESSAGE("Mesh already in Study");
837 THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study",
842 * SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
844 * // Create SComponent labelled 'MED' if it doesn't already exit
845 * SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
846 * if ( CORBA::is_nil(medfather) )
848 * MESSAGE("Add Component MED");
849 * medfather = myBuilder->NewComponent("MED");
850 * //myBuilder->AddAttribute (medfather,SALOMEDS::Name,"MED");
851 * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
852 * myBuilder->FindOrCreateAttribute(medfather, "AttributeName"));
853 * aName->SetValue("MED");
855 * myBuilder->DefineComponentInstance(medfather,myIor);
859 * MESSAGE("Add a mesh Object under MED");
860 * myBuilder->NewCommand();
861 * SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfather);
863 * ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
864 * ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
865 * CORBA::ORB_var &orb = init(0,0);
866 * string iorStr = orb->object_to_string(myIor);
867 * //myBuilder->AddAttribute(newObj,SALOMEDS::IOR,iorStr.c_str());
868 * SALOMEDS::AttributeIOR_var aIOR = SALOMEDS::AttributeIOR::_narrow(
869 * myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"));
870 * aIOR->SetValue(iorStr.c_str());
872 * //myBuilder->AddAttribute(newObj,SALOMEDS::Name,_mesh_i->getName().c_str());
873 * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
874 * myBuilder->FindOrCreateAttribute(newObj, "AttributeName"));
875 * aName->SetValue(_mesh_i->getName().c_str());
877 * _meshId = newObj->GetID();
878 * myBuilder->CommitCommand();
881 END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
884 //=============================================================================
886 * CORBA: write mesh in a med file
888 //=============================================================================
889 void SMESH_MEDMesh_i::write(CORBA::Long i, const char *driverMeshName)
890 throw(SALOME::SALOME_Exception)
892 MESSAGE("Non Implemente");
893 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
896 //=============================================================================
898 * CORBA: read mesh in a med file
900 //=============================================================================
901 void SMESH_MEDMesh_i::read(CORBA::Long i) throw(SALOME::SALOME_Exception)
903 MESSAGE("Non Implemente");
904 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
907 //=============================================================================
909 * CORBA : release driver
911 //=============================================================================
912 void SMESH_MEDMesh_i::rmDriver(CORBA::Long i) throw(SALOME::SALOME_Exception)
914 MESSAGE("Non Implemente");
915 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
918 //=============================================================================
920 * CORBA : attach driver
922 //=============================================================================
923 CORBA::Long SMESH_MEDMesh_i::addDriver(SALOME_MED::medDriverTypes driverType,
924 const char *fileName, const char *meshName) throw(SALOME::SALOME_Exception)
926 MESSAGE("Non Implemente");
927 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
931 //=============================================================================
933 * Calcule le Nb d'elements par entite geometrique
935 //=============================================================================
936 void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception)
942 _mapNbTypes[SALOME_MED::MED_NODE] = 1;
943 // On compte les aretes MED_SEG2 ou MED_SEG3
944 // On range les elements dans les vecteurs correspondants
946 _mapIndToSeqElts[SALOME_MED::MED_SEG2] = _indexElts++;
947 _mapIndToSeqElts[SALOME_MED::MED_SEG3] = _indexElts++;
948 _mapIndToVectTypes[SALOME_MED::MED_EDGE] = _indexEnts++;
952 SALOME_MED::medGeometryElement medElement;
954 SMDS_EdgeIteratorPtr itEdges=_meshDS->edgesIterator();
955 while(itEdges->more())
957 const SMDS_MeshEdge* elem = itEdges->next();
958 int nb_of_nodes = elem->NbNodes();
964 medElement = SALOME_MED::MED_SEG2;
968 _TypesId[SALOME_MED::MED_EDGE].
969 push_back(SALOME_MED::MED_SEG2);
975 medElement = SALOME_MED::MED_SEG3;
979 _TypesId[SALOME_MED::MED_EDGE].
980 push_back(SALOME_MED::MED_SEG3);
985 int index = _mapIndToSeqElts[medElement];
987 // Traitement de l arete
989 int longueur = _seq_elemId[index]->length();
990 _seq_elemId[index]->length(longueur + nb_of_nodes);
992 SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
994 for(int k=0; itn->more(); k++)
995 _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_FaceIteratorPtr 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_NodeIteratorPtr itn=_meshDS->nodesIterator();
1064 for(int k=0; itn->more(); k++)
1065 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
1068 _mapNbTypes[SALOME_MED::MED_FACE] =
1069 trouveTria3 + trouveTria6 + trouveQuad4;
1071 _mapIndToSeqElts[SALOME_MED::MED_HEXA8] = _indexElts++;
1072 _mapIndToVectTypes[SALOME_MED::MED_CELL] = _indexEnts++;
1073 int index = _mapIndToSeqElts[medElement];
1075 int trouveHexa8 = 0;
1077 SMDS_VolumeIteratorPtr itVolumes=_meshDS->volumesIterator();
1078 while(itVolumes->more())
1080 const SMDS_MeshVolume * elem = itVolumes->next();
1082 int nb_of_nodes = elem->NbNodes();
1083 medElement = SALOME_MED::MED_HEXA8;
1084 ASSERT(nb_of_nodes == 8);
1086 if (trouveHexa8 == 0)
1089 _TypesId[SALOME_MED::MED_CELL].push_back(SALOME_MED::MED_HEXA8);
1091 // Traitement de la maille
1092 int longueur = _seq_elemId[index]->length();
1093 _seq_elemId[index]->length(longueur + nb_of_nodes);
1095 SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
1096 for(int k=0; itn->more(); k++)
1097 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
1100 _mapNbTypes[SALOME_MED::MED_CELL] = trouveHexa8;
1101 _mapNbTypes[SALOME_MED::MED_ALL_ENTITIES]
1103 trouveHexa8 + trouveTria3 + trouveTria6 + trouveQuad4 + trouveSeg2 +
1108 //=============================================================================
1110 * Creation des familles
1112 //=============================================================================
1113 void SMESH_MEDMesh_i::createFamilies() throw(SALOME::SALOME_Exception)
1115 Unexpect aCatch(SALOME_SalomeException);
1116 string famDes = ("Je ne sais pas");
1117 string famName0 = "Famille_";
1121 if (_creeFamily == false)
1124 //SMESH_subMesh_i *subMeshServant;
1126 map < int, SMESH_subMesh_i * >::iterator it;
1127 for (it = _mesh_i->_mapSubMesh_i.begin();
1128 it != _mesh_i->_mapSubMesh_i.end(); it++)
1130 SMESH_subMesh_i *submesh_i = (*it).second;
1131 int famIdent = (*it).first;
1133 ASSERT(famIdent < 999999999);
1134 sprintf(numero, "%d\n", famIdent);
1135 famName = famName0 + numero;
1137 SMESH_MEDFamily_i *famservant =
1138 new SMESH_MEDFamily_i(famIdent, submesh_i,
1139 famName, famDes, SALOME_MED::MED_NODE);
1140 SALOME_MED::FAMILY_ptr famille =
1141 SALOME_MED::FAMILY::_narrow(famservant->
1142 POA_SALOME_MED::FAMILY::_this());
1143 _families.push_back(famille);
1147 //=============================================================================
1149 * Gives informations of the considered mesh.
1151 //=============================================================================
1152 SALOME_MED::MESH::meshInfos * SMESH_MEDMesh_i::getMeshGlobal()
1153 throw (SALOME::SALOME_Exception)
1155 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1157 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1161 //=============================================================================
1163 * Gives informations on coordinates of the considered mesh.
1165 //=============================================================================
1166 SALOME_MED::MESH::coordinateInfos * SMESH_MEDMesh_i::getCoordGlobal()
1167 throw (SALOME::SALOME_Exception)
1169 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1171 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1175 //=============================================================================
1177 * Gives informations on connectivities of the considered mesh for the entity
1180 //=============================================================================
1181 SALOME_MED::MESH::connectivityInfos *
1182 SMESH_MEDMesh_i::getConnectGlobal(SALOME_MED::medEntityMesh entity)
1183 throw (SALOME::SALOME_Exception)
1185 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1187 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1191 //=============================================================================
1193 * Gives the type of the element number of entity entity
1195 //=============================================================================
1196 SALOME_MED::medGeometryElement
1197 SMESH_MEDMesh_i::getElementType(SALOME_MED::medEntityMesh entity,
1199 throw (SALOME::SALOME_Exception)
1201 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1203 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1205 return (SALOME_MED::medGeometryElement) 0;