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(""),
90 _creeFamily(false), _famIdent(0), _indexElts(0), _indexEnts(0)
93 _meshDS = _mesh_i->GetImpl().GetMeshDS();
95 BEGIN_OF("Constructor SMESH_MEDMesh_i");
96 END_OF("Constructor SMESH_MEDMesh_i");
99 //=============================================================================
101 * CORBA: Accessor for Name
103 //=============================================================================
104 char *SMESH_MEDMesh_i::getName() throw(SALOME::SALOME_Exception)
107 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
108 SALOME::INTERNAL_ERROR);
112 // A COMPLETER PAR LE NOM DU MAILLAGE
113 //return CORBA::string_dup(_mesh_i->getName().c_str());
114 return CORBA::string_dup("toto");
118 MESSAGE("Exception en accedant au nom");
119 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
120 SALOME::INTERNAL_ERROR);
124 //=============================================================================
126 * CORBA: Accessor for corbaindex cuisine interne
128 //=============================================================================
129 CORBA::Long SMESH_MEDMesh_i::getCorbaIndex()throw(SALOME::SALOME_Exception)
131 MESSAGE("Non Implemente");
132 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
135 //=============================================================================
137 * CORBA: Accessor for Space Dimension
139 //=============================================================================
140 CORBA::Long SMESH_MEDMesh_i::getSpaceDimension()throw(SALOME::SALOME_Exception)
142 // PN : Il semblerait que la dimension soit fixee a 3
144 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
145 SALOME::INTERNAL_ERROR);
149 //=============================================================================
151 * CORBA: Accessor for Mesh Dimension
153 //=============================================================================
154 CORBA::Long SMESH_MEDMesh_i::getMeshDimension()throw(SALOME::SALOME_Exception)
157 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
158 SALOME::INTERNAL_ERROR);
159 // PN : Il semblerait que la dimension soit fixee a 3
161 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
162 SALOME::INTERNAL_ERROR);
165 //=============================================================================
167 * CORBA: Accessor for the boolean _isAGrid
169 //=============================================================================
170 CORBA::Boolean SMESH_MEDMesh_i::getIsAGrid() throw (SALOME::SALOME_Exception)
172 MESSAGE("!!!!!! NOT YET IMPLEMENTED !!!!!!");
174 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
178 //=============================================================================
180 * CORBA: Accessor for the connectivities, to see if they exist
182 //=============================================================================
184 SMESH_MEDMesh_i::existConnectivity(SALOME_MED::medConnectivity connectivityType,
185 SALOME_MED::medEntityMesh entity)
186 throw (SALOME::SALOME_Exception)
188 MESSAGE("!!!!!! IMPLEMENTED BUT ONLY PARTIALLY !!!!!!");
194 //=============================================================================
196 * CORBA: Accessor for Coordinate
198 //=============================================================================
199 CORBA::Double SMESH_MEDMesh_i::getCoordinate(CORBA::Long Number, CORBA::Long Axis)
200 throw (SALOME::SALOME_Exception)
202 MESSAGE("!!!!!! NOT YET IMPLEMENTED !!!!");
204 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
208 //=============================================================================
210 * CORBA: Accessor for Coordinates System
212 //=============================================================================
213 char *SMESH_MEDMesh_i::getCoordinatesSystem() throw(SALOME::SALOME_Exception)
216 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
217 SALOME::INTERNAL_ERROR);
218 // PN : En dur. Non encore prevu
221 string systcoo = "CARTESIEN";
222 return CORBA::string_dup(systcoo.c_str());
226 MESSAGE("Exception en accedant au maillage");
227 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
228 SALOME::INTERNAL_ERROR);
232 //=============================================================================
234 * CORBA: Accessor for Coordinates
236 //=============================================================================
237 SALOME_MED::double_array * SMESH_MEDMesh_i::getCoordinates(
238 SALOME_MED::medModeSwitch typeSwitch) throw(SALOME::SALOME_Exception)
241 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
242 SALOME::INTERNAL_ERROR);
243 SALOME_MED::double_array_var myseq = new SALOME_MED::double_array;
247 int spaceDimension = 3;
248 int nbNodes = _meshDS->NbNodes();
250 myseq->length(nbNodes * spaceDimension);
253 SMDS_Iterator<const SMDS_MeshNode *> * itNodes=_meshDS->nodesIterator();
254 while(itNodes->more())
256 const SMDS_MeshNode* node = itNodes->next();
258 if (typeSwitch == SALOME_MED::MED_FULL_INTERLACE)
260 myseq[i * 3] = node->X();
261 myseq[i * 3 + 1] = node->Y();
262 myseq[i * 3 + 2] = node->Z();
263 SCRUTE(myseq[i * 3]);
264 SCRUTE(myseq[i * 3 + 1]);
265 SCRUTE(myseq[i * 3 + 2]);
269 ASSERT(typeSwitch == SALOME_MED::MED_NO_INTERLACE);
270 myseq[i] = node->X();
271 myseq[i + nbNodes] = node->Y();
272 myseq[i + (nbNodes * 2)] = node->Z();
274 SCRUTE(myseq[i + nbNodes]);
275 SCRUTE(myseq[i + (nbNodes * 2)]);
283 MESSAGE("Exception en accedant aux coordonnees");
284 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
285 SALOME::INTERNAL_ERROR);
287 return myseq._retn();
290 //=============================================================================
292 * CORBA: Accessor for Coordinates Names
294 //=============================================================================
295 SALOME_MED::string_array *
296 SMESH_MEDMesh_i::getCoordinatesNames()throw(SALOME::SALOME_Exception)
299 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
300 SALOME::INTERNAL_ERROR);
301 SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
305 int spaceDimension = 3;
306 myseq->length(spaceDimension);
307 myseq[0] = CORBA::string_dup("x");
308 myseq[1] = CORBA::string_dup("y");
309 myseq[2] = CORBA::string_dup("z");
313 MESSAGE("Exception en accedant aux noms des coordonnees");
314 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
315 SALOME::INTERNAL_ERROR);
317 return myseq._retn();
321 //=============================================================================
323 * CORBA: Accessor for Coordinates Units
325 //=============================================================================
326 SALOME_MED::string_array *
327 SMESH_MEDMesh_i::getCoordinatesUnits()throw(SALOME::SALOME_Exception)
330 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
331 SALOME::INTERNAL_ERROR);
332 SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
336 int spaceDimension = 3;
337 myseq->length(spaceDimension);
338 myseq[0] = CORBA::string_dup("m");
339 myseq[1] = CORBA::string_dup("m");
340 myseq[2] = CORBA::string_dup("m");
344 MESSAGE("Exception en accedant aux unites des coordonnees");
345 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
346 SALOME::INTERNAL_ERROR);
348 return myseq._retn();
351 //=============================================================================
353 * CORBA: Accessor for Number of Nodes
355 //=============================================================================
356 CORBA::Long SMESH_MEDMesh_i::getNumberOfNodes()throw(SALOME::SALOME_Exception)
359 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
360 SALOME::INTERNAL_ERROR);
363 return _meshDS->NbNodes();
367 MESSAGE("Exception en accedant au nombre de noeuds");
368 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
369 SALOME::INTERNAL_ERROR);
373 //=============================================================================
375 * CORBA: Accessor for number of Types
377 //=============================================================================
378 CORBA::Long SMESH_MEDMesh_i::getNumberOfTypes(SALOME_MED::medEntityMesh entity)
379 throw(SALOME::SALOME_Exception)
382 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
383 SALOME::INTERNAL_ERROR);
389 if (_mapNbTypes.find(entity) != _mapNbTypes.end())
390 retour = _mapNbTypes[entity];
395 MESSAGE("Exception en accedant au nombre de Types");
396 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
397 SALOME::INTERNAL_ERROR);
401 //=============================================================================
403 * CORBA: Accessor for existing geometry element types
404 * Not implemented for MED_ALL_ENTITIES
406 //=============================================================================
407 SALOME_MED::medGeometryElement_array *
408 SMESH_MEDMesh_i::getTypes(SALOME_MED::medEntityMesh entity) throw(SALOME::
412 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
413 SALOME::INTERNAL_ERROR);
414 if (entity == SALOME_MED::MED_ALL_ENTITIES)
415 THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ENTITIES",
419 SALOME_MED::medGeometryElement_array_var myseq =
420 new SALOME_MED::medGeometryElement_array;
423 if (_mapNbTypes.find(entity) == _mapNbTypes.end())
424 THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh",
426 int nbTypes = _mapNbTypes[entity];
428 myseq->length(nbTypes);
430 if (_mapIndToVectTypes.find(entity) == _mapIndToVectTypes.end())
431 THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh",
432 SALOME::INTERNAL_ERROR);
434 int index = _mapIndToVectTypes[entity];
435 ASSERT(_TypesId[index].size() != 0);
437 vector < SALOME_MED::medGeometryElement >::iterator it;
438 for (it = _TypesId[index].begin(); it != _TypesId[index].end(); it++)
445 MESSAGE("Exception en accedant aux differents types");
446 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
447 SALOME::INTERNAL_ERROR);
449 return myseq._retn();
452 //=============================================================================
454 * CORBA: Returns number of elements of type medGeometryElement
455 * Not implemented for MED_ALL_ELEMENTS
456 * implemented for MED_ALL_ENTITIES
458 * Dans cette implementation, il n est pas prevu de tenir compte du entity
459 * qui ne doit pas pouvoir avoir deux valeurs differentes pour un geomElement
461 //=============================================================================
462 CORBA::Long SMESH_MEDMesh_i::getNumberOfElements(SALOME_MED::
463 medEntityMesh entity,
464 SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
467 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
468 SALOME::INTERNAL_ERROR);
469 if (geomElement == SALOME_MED::MED_ALL_ELEMENTS)
470 THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ELEMENTS",
478 if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end())
480 int index = _mapIndToSeqElts[geomElement];
481 retour = _seq_elemId[index]->length();
487 MESSAGE("Exception en accedant au nombre d élements");
488 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
489 SALOME::INTERNAL_ERROR);
493 //=============================================================================
495 * CORBA: Accessor for connectivities
497 //=============================================================================
498 SALOME_MED::long_array *
499 SMESH_MEDMesh_i::getConnectivity(SALOME_MED::medModeSwitch typeSwitch,
500 SALOME_MED::medConnectivity mode,
501 SALOME_MED::medEntityMesh entity,
502 SALOME_MED::medGeometryElement geomElement)
503 throw(SALOME::SALOME_Exception)
506 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
507 SALOME::INTERNAL_ERROR);
508 if (mode != SALOME_MED::MED_NODAL)
509 THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
510 if (typeSwitch == SALOME_MED::MED_NO_INTERLACE)
511 THROW_SALOME_CORBA_EXCEPTION("Not Yet Implemented", SALOME::BAD_PARAM);
515 // Faut-il renvoyer un pointeur vide ???
516 if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end())
517 THROW_SALOME_CORBA_EXCEPTION("No Such Element in the mesh",
520 int index = _mapIndToSeqElts[geomElement];
521 return _seq_elemId[index]._retn();
524 //=============================================================================
526 * CORBA: Accessor for connectivities
528 //=============================================================================
529 SALOME_MED::long_array *
530 SMESH_MEDMesh_i::getConnectivityIndex(SALOME_MED::medConnectivity mode,
531 SALOME_MED::medEntityMesh entity)
532 throw(SALOME::SALOME_Exception)
534 MESSAGE("Pas Implemente dans SMESH");
535 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
539 //=============================================================================
541 * CORBA: Find an element corresponding to the given connectivity
543 //=============================================================================
545 SMESH_MEDMesh_i::getElementNumber(SALOME_MED::medConnectivity mode,
546 SALOME_MED::medEntityMesh entity,
547 SALOME_MED::medGeometryElement type,
548 const SALOME_MED::long_array & connectivity)
549 throw(SALOME::SALOME_Exception)
551 const char *LOC = "getElementNumber ";
552 MESSAGE(LOC << "Pas Implemente dans SMESH");
553 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
557 //=============================================================================
559 * CORBA: Accessor for Ascendant connectivities
560 * not implemented for MED_ALL_ENTITIES and MED_MAILLE
562 //=============================================================================
563 SALOME_MED::long_array *
564 SMESH_MEDMesh_i::getReverseConnectivity(SALOME_MED::
565 medConnectivity mode) throw(SALOME::SALOME_Exception)
567 MESSAGE("Pas Implemente dans SMESH");
568 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
572 //=============================================================================
574 * CORBA: Accessor for connectivities
576 //=============================================================================
577 SALOME_MED::long_array *
578 SMESH_MEDMesh_i::getReverseConnectivityIndex(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: Returns number of families within the mesh
590 //=============================================================================
591 CORBA::Long SMESH_MEDMesh_i::getNumberOfFamilies(SALOME_MED::
592 medEntityMesh entity) throw(SALOME::SALOME_Exception)
594 if (_creeFamily == false)
597 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
598 SALOME::INTERNAL_ERROR);
599 return _families.size();
602 //=============================================================================
604 * CORBA: Returns number of groups within the mesh
606 //=============================================================================
607 CORBA::Long SMESH_MEDMesh_i::getNumberOfGroups(SALOME_MED::medEntityMesh entity)
608 throw(SALOME::SALOME_Exception)
611 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
612 SALOME::INTERNAL_ERROR);
613 MESSAGE(" Pas d implementation des groupes dans SMESH");
617 //=============================================================================
619 * CORBA: Returns references for families within the mesh
621 //=============================================================================
622 SALOME_MED::Family_array *
623 SMESH_MEDMesh_i::getFamilies(SALOME_MED::
624 medEntityMesh entity) throw(SALOME::SALOME_Exception)
626 if (_creeFamily == false)
629 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
630 SALOME::INTERNAL_ERROR);
631 SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array;
632 int nbfam = _families.size();
633 myseq->length(nbfam);
635 vector < SALOME_MED::FAMILY_ptr >::iterator it;
636 for (it = _families.begin(); it != _families.end(); it++)
640 return myseq._retn();
643 //=============================================================================
645 * CORBA: Returns references for family i within the mesh
647 //=============================================================================
648 SALOME_MED::FAMILY_ptr SMESH_MEDMesh_i::getFamily(SALOME_MED::
649 medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception)
651 if (_creeFamily == false)
654 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
655 SALOME::INTERNAL_ERROR);
657 SCRUTE(_families[i]->getName());
658 MESSAGE(" SMESH_MEDMesh_i::getFamily " << i) return _families[i];
661 //=============================================================================
663 * CORBA: Returns references for groups within the mesh
665 //=============================================================================
666 SALOME_MED::Group_array *
667 SMESH_MEDMesh_i::getGroups(SALOME_MED::medEntityMesh entity) throw(SALOME::
671 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
672 SALOME::INTERNAL_ERROR);
673 MESSAGE(" Pas d implementation des groupes dans SMESH");
674 THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
677 //=============================================================================
679 * CORBA: Returns references for group i within the mesh
681 //=============================================================================
682 SALOME_MED::GROUP_ptr SMESH_MEDMesh_i::getGroup(SALOME_MED::
683 medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception)
686 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
687 SALOME::INTERNAL_ERROR);
688 MESSAGE(" Pas d implementation des groupes dans SMESH");
689 THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
691 //=============================================================================
693 * CORBA: Returns references for the global numbering index
695 //=============================================================================
696 SALOME_MED::long_array*
697 SMESH_MEDMesh_i::getGlobalNumberingIndex(SALOME_MED::medEntityMesh entity)
698 throw (SALOME::SALOME_Exception)
700 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
702 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
706 //=============================================================================
708 * CORBA: Returns references for the support of boundary elements of type
711 //=============================================================================
712 SALOME_MED::SUPPORT_ptr
713 SMESH_MEDMesh_i::getBoundaryElements(SALOME_MED::medEntityMesh entity)
714 throw (SALOME::SALOME_Exception)
716 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
718 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
722 //=============================================================================
724 * CORBA: Returns references for the support of the skin of the support
727 //=============================================================================
728 SALOME_MED::SUPPORT_ptr
729 SMESH_MEDMesh_i::getSkin(SALOME_MED::SUPPORT_ptr mySupport3D)
730 throw (SALOME::SALOME_Exception)
732 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
734 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
738 //=============================================================================
742 //=============================================================================
743 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getVolume(SALOME_MED::
744 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
746 MESSAGE("Pas Implemente dans SMESH");
747 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
751 //=============================================================================
755 //=============================================================================
756 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getArea(SALOME_MED::
757 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
759 MESSAGE("Pas Implemente dans SMESH");
760 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
764 //=============================================================================
768 //=============================================================================
769 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getLength(SALOME_MED::
770 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
772 MESSAGE("Pas Implemente dans SMESH");
773 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
777 //=============================================================================
781 //=============================================================================
782 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNormal(SALOME_MED::
783 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
785 MESSAGE("Pas Implemente dans SMESH");
786 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
790 //=============================================================================
794 //=============================================================================
795 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getBarycenter(SALOME_MED::
796 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
798 MESSAGE("Pas Implemente dans SMESH");
799 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
803 //=============================================================================
807 //=============================================================================
808 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNeighbourhood(SALOME_MED::
809 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
811 MESSAGE("Non Implemente");
812 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
816 //=============================================================================
818 * CORBA: add the Mesh in the StudyManager
821 //=============================================================================
822 void SMESH_MEDMesh_i::addInStudy(SALOMEDS::Study_ptr myStudy,
823 SALOME_MED::MESH_ptr myIor) throw(SALOME::SALOME_Exception)
825 BEGIN_OF("MED_Mesh_i::addInStudy");
828 MESSAGE("Mesh already in Study");
829 THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study",
834 * SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
836 * // Create SComponent labelled 'MED' if it doesn't already exit
837 * SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
838 * if ( CORBA::is_nil(medfather) )
840 * MESSAGE("Add Component MED");
841 * medfather = myBuilder->NewComponent("MED");
842 * //myBuilder->AddAttribute (medfather,SALOMEDS::Name,"MED");
843 * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
844 * myBuilder->FindOrCreateAttribute(medfather, "AttributeName"));
845 * aName->SetValue("MED");
847 * myBuilder->DefineComponentInstance(medfather,myIor);
851 * MESSAGE("Add a mesh Object under MED");
852 * myBuilder->NewCommand();
853 * SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfather);
855 * ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
856 * ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
857 * CORBA::ORB_var &orb = init(0,0);
858 * string iorStr = orb->object_to_string(myIor);
859 * //myBuilder->AddAttribute(newObj,SALOMEDS::IOR,iorStr.c_str());
860 * SALOMEDS::AttributeIOR_var aIOR = SALOMEDS::AttributeIOR::_narrow(
861 * myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"));
862 * aIOR->SetValue(iorStr.c_str());
864 * //myBuilder->AddAttribute(newObj,SALOMEDS::Name,_mesh_i->getName().c_str());
865 * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
866 * myBuilder->FindOrCreateAttribute(newObj, "AttributeName"));
867 * aName->SetValue(_mesh_i->getName().c_str());
869 * _meshId = newObj->GetID();
870 * myBuilder->CommitCommand();
873 END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
876 //=============================================================================
878 * CORBA: write mesh in a med file
880 //=============================================================================
881 void SMESH_MEDMesh_i::write(CORBA::Long i, const char *driverMeshName)
882 throw(SALOME::SALOME_Exception)
884 MESSAGE("Non Implemente");
885 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
888 //=============================================================================
890 * CORBA: read mesh in a med file
892 //=============================================================================
893 void SMESH_MEDMesh_i::read(CORBA::Long i) throw(SALOME::SALOME_Exception)
895 MESSAGE("Non Implemente");
896 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
899 //=============================================================================
901 * CORBA : release driver
903 //=============================================================================
904 void SMESH_MEDMesh_i::rmDriver(CORBA::Long i) throw(SALOME::SALOME_Exception)
906 MESSAGE("Non Implemente");
907 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
910 //=============================================================================
912 * CORBA : attach driver
914 //=============================================================================
915 CORBA::Long SMESH_MEDMesh_i::addDriver(SALOME_MED::medDriverTypes driverType,
916 const char *fileName, const char *meshName) throw(SALOME::SALOME_Exception)
918 MESSAGE("Non Implemente");
919 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
923 //=============================================================================
925 * Calcule le Nb d'elements par entite geometrique
927 //=============================================================================
928 void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception)
934 _mapNbTypes[SALOME_MED::MED_NODE] = 1;
935 // On compte les aretes MED_SEG2 ou MED_SEG3
936 // On range les elements dans les vecteurs correspondants
938 _mapIndToSeqElts[SALOME_MED::MED_SEG2] = _indexElts++;
939 _mapIndToSeqElts[SALOME_MED::MED_SEG3] = _indexElts++;
940 _mapIndToVectTypes[SALOME_MED::MED_EDGE] = _indexEnts++;
944 SALOME_MED::medGeometryElement medElement;
946 SMDS_Iterator<const SMDS_MeshEdge*> * itEdges=_meshDS->edgesIterator();
947 while(itEdges->more())
949 const SMDS_MeshEdge* elem = itEdges->next();
950 int nb_of_nodes = elem->NbNodes();
956 medElement = SALOME_MED::MED_SEG2;
960 _TypesId[SALOME_MED::MED_EDGE].
961 push_back(SALOME_MED::MED_SEG2);
967 medElement = SALOME_MED::MED_SEG3;
971 _TypesId[SALOME_MED::MED_EDGE].
972 push_back(SALOME_MED::MED_SEG3);
977 int index = _mapIndToSeqElts[medElement];
979 // Traitement de l arete
980 int longueur = _seq_elemId[index]->length();
981 _seq_elemId[index]->length(longueur + nb_of_nodes);
983 SMDS_Iterator<const SMDS_MeshNode*> * itn=_meshDS->nodesIterator();
985 for(int k=0; itn->more(); k++)
986 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
991 _mapNbTypes[SALOME_MED::MED_EDGE] = trouveSeg2 + trouveSeg3;
993 // On compte les faces MED_TRIA3, MED_HEXA8, MED_TRIA6
994 // On range les elements dans les vecteurs correspondants
999 _mapIndToSeqElts[SALOME_MED::MED_TRIA3] = _indexElts++;
1000 _mapIndToSeqElts[SALOME_MED::MED_TRIA6] = _indexElts++;
1001 _mapIndToSeqElts[SALOME_MED::MED_QUAD4] = _indexElts++;
1002 _mapIndToVectTypes[SALOME_MED::MED_FACE] = _indexEnts++;
1004 SMDS_Iterator<const SMDS_MeshFace*> * itFaces=_meshDS->facesIterator();
1005 while(itFaces->more())
1007 const SMDS_MeshFace * elem = itFaces->next();
1008 int nb_of_nodes = elem->NbNodes();
1010 switch (nb_of_nodes)
1014 medElement = SALOME_MED::MED_TRIA3;
1015 if (trouveTria3 == 0)
1018 _TypesId[SALOME_MED::MED_FACE].
1019 push_back(SALOME_MED::MED_TRIA3);
1025 medElement = SALOME_MED::MED_QUAD4;
1026 if (trouveQuad4 == 0)
1029 _TypesId[SALOME_MED::MED_FACE].
1030 push_back(SALOME_MED::MED_QUAD4);
1036 medElement = SALOME_MED::MED_TRIA6;
1037 if (trouveTria6 == 0)
1040 _TypesId[SALOME_MED::MED_FACE].
1041 push_back(SALOME_MED::MED_TRIA6);
1046 int index = _mapIndToSeqElts[medElement];
1049 // Traitement de la face
1050 // Attention La numérotation des noeuds Med commence a 1
1052 int longueur = _seq_elemId[index]->length();
1053 _seq_elemId[index]->length(longueur + nb_of_nodes);
1055 SMDS_Iterator<const SMDS_MeshNode*> * itn=_meshDS->nodesIterator();
1057 for(int k=0; itn->more(); k++)
1058 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
1063 _mapNbTypes[SALOME_MED::MED_FACE] =
1064 trouveTria3 + trouveTria6 + trouveQuad4;
1066 _mapIndToSeqElts[SALOME_MED::MED_HEXA8] = _indexElts++;
1067 _mapIndToVectTypes[SALOME_MED::MED_CELL] = _indexEnts++;
1068 int index = _mapIndToSeqElts[medElement];
1070 int trouveHexa8 = 0;
1072 SMDS_Iterator<const SMDS_MeshVolume*> * itVolumes=_meshDS->volumesIterator();
1073 while(itVolumes->more())
1075 const SMDS_MeshVolume * elem = itVolumes->next();
1077 int nb_of_nodes = elem->NbNodes();
1078 medElement = SALOME_MED::MED_HEXA8;
1079 ASSERT(nb_of_nodes = 8);
1081 if (trouveHexa8 == 0)
1084 _TypesId[SALOME_MED::MED_CELL].push_back(SALOME_MED::MED_HEXA8);
1086 // Traitement de la maille
1087 int longueur = _seq_elemId[index]->length();
1088 _seq_elemId[index]->length(longueur + nb_of_nodes);
1090 SMDS_Iterator<const SMDS_MeshNode*> * itn=_meshDS->nodesIterator();
1091 for(int k=0; itn->more(); k++)
1092 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
1097 _mapNbTypes[SALOME_MED::MED_CELL] = trouveHexa8;
1098 _mapNbTypes[SALOME_MED::MED_ALL_ENTITIES]
1100 trouveHexa8 + trouveTria3 + trouveTria6 + trouveQuad4 + trouveSeg2 +
1105 //=============================================================================
1107 * Creation des familles
1109 //=============================================================================
1110 void SMESH_MEDMesh_i::createFamilies() throw(SALOME::SALOME_Exception)
1112 string famDes = ("Je ne sais pas");
1113 string famName0 = "Famille_";
1117 if (_creeFamily == false)
1120 SMESH_subMesh_i *subMeshServant;
1122 map < int, SMESH_subMesh_i * >::iterator it;
1123 for (it = _mesh_i->_mapSubMesh_i.begin();
1124 it != _mesh_i->_mapSubMesh_i.end(); it++)
1126 SMESH_subMesh_i *submesh_i = (*it).second;
1127 int famIdent = (*it).first;
1129 ASSERT(famIdent < 999999999);
1130 sprintf(numero, "%d\n", famIdent);
1131 famName = famName0 + numero;
1133 SMESH_MEDFamily_i *famservant =
1134 new SMESH_MEDFamily_i(famIdent, submesh_i,
1135 famName, famDes, SALOME_MED::MED_NODE);
1136 SALOME_MED::FAMILY_ptr famille =
1137 SALOME_MED::FAMILY::_narrow(famservant->
1138 POA_SALOME_MED::FAMILY::_this());
1139 _families.push_back(famille);
1143 //=============================================================================
1145 * Gives informations of the considered mesh.
1147 //=============================================================================
1148 SALOME_MED::MESH::meshInfos * SMESH_MEDMesh_i::getMeshGlobal()
1149 throw (SALOME::SALOME_Exception)
1151 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1153 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1157 //=============================================================================
1159 * Gives informations on coordinates of the considered mesh.
1161 //=============================================================================
1162 SALOME_MED::MESH::coordinateInfos * SMESH_MEDMesh_i::getCoordGlobal()
1163 throw (SALOME::SALOME_Exception)
1165 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1167 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1171 //=============================================================================
1173 * Gives informations on connectivities of the considered mesh for the entity
1176 //=============================================================================
1177 SALOME_MED::MESH::connectivityInfos *
1178 SMESH_MEDMesh_i::getConnectGlobal(SALOME_MED::medEntityMesh entity)
1179 throw (SALOME::SALOME_Exception)
1181 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1183 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1187 //=============================================================================
1189 * Gives the type of the element number of entity entity
1191 //=============================================================================
1192 SALOME_MED::medGeometryElement
1193 SMESH_MEDMesh_i::getElementType(SALOME_MED::medEntityMesh entity,
1195 throw (SALOME::SALOME_Exception)
1197 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1199 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);