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 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 //=============================================================================
544 CORBA::Long SMESH_MEDMesh_i::getElementNumber(SALOME_MED::medConnectivity mode,
545 SALOME_MED::medEntityMesh entity,
546 SALOME_MED::medGeometryElement type,
547 const SALOME_MED::long_array & connectivity)
548 throw(SALOME::SALOME_Exception)
550 const char *LOC = "getElementNumber ";
551 MESSAGE(LOC << "Pas Implemente dans SMESH");
552 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
556 //=============================================================================
558 * CORBA: Accessor for Ascendant connectivities
559 * not implemented for MED_ALL_ENTITIES and MED_MAILLE
561 //=============================================================================
562 SALOME_MED::long_array *
563 SMESH_MEDMesh_i::getReverseConnectivity(SALOME_MED::
564 medConnectivity mode) throw(SALOME::SALOME_Exception)
566 MESSAGE("Pas Implemente dans SMESH");
567 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
571 //=============================================================================
573 * CORBA: Accessor for connectivities
575 //=============================================================================
576 SALOME_MED::long_array *
577 SMESH_MEDMesh_i::getReverseConnectivityIndex(SALOME_MED::
578 medConnectivity mode) throw(SALOME::SALOME_Exception)
580 MESSAGE("Pas Implemente dans SMESH");
581 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
585 //=============================================================================
587 * CORBA: Returns number of families within the mesh
589 //=============================================================================
590 CORBA::Long SMESH_MEDMesh_i::getNumberOfFamilies(SALOME_MED::
591 medEntityMesh entity) throw(SALOME::SALOME_Exception)
593 if (_creeFamily == false)
596 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
597 SALOME::INTERNAL_ERROR);
598 return _families.size();
601 //=============================================================================
603 * CORBA: Returns number of groups within the mesh
605 //=============================================================================
606 CORBA::Long SMESH_MEDMesh_i::getNumberOfGroups(SALOME_MED::medEntityMesh entity)
607 throw(SALOME::SALOME_Exception)
610 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
611 SALOME::INTERNAL_ERROR);
612 MESSAGE(" Pas d implementation des groupes dans SMESH");
616 //=============================================================================
618 * CORBA: Returns references for families within the mesh
620 //=============================================================================
621 SALOME_MED::Family_array *
622 SMESH_MEDMesh_i::getFamilies(SALOME_MED::
623 medEntityMesh entity) throw(SALOME::SALOME_Exception)
625 if (_creeFamily == false)
628 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
629 SALOME::INTERNAL_ERROR);
630 SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array;
631 int nbfam = _families.size();
632 myseq->length(nbfam);
634 vector < SALOME_MED::FAMILY_ptr >::iterator it;
635 for (it = _families.begin(); it != _families.end(); it++)
639 return myseq._retn();
642 //=============================================================================
644 * CORBA: Returns references for family i within the mesh
646 //=============================================================================
647 SALOME_MED::FAMILY_ptr SMESH_MEDMesh_i::getFamily(SALOME_MED::
648 medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception)
650 if (_creeFamily == false)
653 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
654 SALOME::INTERNAL_ERROR);
656 SCRUTE(_families[i]->getName());
657 MESSAGE(" SMESH_MEDMesh_i::getFamily " << i) return _families[i];
660 //=============================================================================
662 * CORBA: Returns references for groups within the mesh
664 //=============================================================================
665 SALOME_MED::Group_array *
666 SMESH_MEDMesh_i::getGroups(SALOME_MED::medEntityMesh entity) throw(SALOME::
670 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
671 SALOME::INTERNAL_ERROR);
672 MESSAGE(" Pas d implementation des groupes dans SMESH");
673 THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
676 //=============================================================================
678 * CORBA: Returns references for group i within the mesh
680 //=============================================================================
681 SALOME_MED::GROUP_ptr SMESH_MEDMesh_i::getGroup(SALOME_MED::
682 medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception)
685 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
686 SALOME::INTERNAL_ERROR);
687 MESSAGE(" Pas d implementation des groupes dans SMESH");
688 THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
690 //=============================================================================
692 * CORBA: Returns references for the global numbering index
694 //=============================================================================
695 SALOME_MED::long_array*
696 SMESH_MEDMesh_i::getGlobalNumberingIndex(SALOME_MED::medEntityMesh entity)
697 throw (SALOME::SALOME_Exception)
699 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
701 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
705 //=============================================================================
707 * CORBA: Returns references for the support of boundary elements of type
710 //=============================================================================
711 SALOME_MED::SUPPORT_ptr
712 SMESH_MEDMesh_i::getBoundaryElements(SALOME_MED::medEntityMesh entity)
713 throw (SALOME::SALOME_Exception)
715 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
717 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
721 //=============================================================================
723 * CORBA: Returns references for the support of the skin of the support
726 //=============================================================================
727 SALOME_MED::SUPPORT_ptr
728 SMESH_MEDMesh_i::getSkin(SALOME_MED::SUPPORT_ptr mySupport3D)
729 throw (SALOME::SALOME_Exception)
731 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
733 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
737 //=============================================================================
741 //=============================================================================
742 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getVolume(SALOME_MED::
743 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
745 MESSAGE("Pas Implemente dans SMESH");
746 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
750 //=============================================================================
754 //=============================================================================
755 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getArea(SALOME_MED::
756 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
758 MESSAGE("Pas Implemente dans SMESH");
759 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
763 //=============================================================================
767 //=============================================================================
768 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getLength(SALOME_MED::
769 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
771 MESSAGE("Pas Implemente dans SMESH");
772 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
776 //=============================================================================
780 //=============================================================================
781 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNormal(SALOME_MED::
782 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
784 MESSAGE("Pas Implemente dans SMESH");
785 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
789 //=============================================================================
793 //=============================================================================
794 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getBarycenter(SALOME_MED::
795 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
797 MESSAGE("Pas Implemente dans SMESH");
798 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
802 //=============================================================================
806 //=============================================================================
807 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNeighbourhood(SALOME_MED::
808 SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception)
810 MESSAGE("Non Implemente");
811 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
815 //=============================================================================
817 * CORBA: add the Mesh in the StudyManager
820 //=============================================================================
821 void SMESH_MEDMesh_i::addInStudy(SALOMEDS::Study_ptr myStudy,
822 SALOME_MED::MESH_ptr myIor) throw(SALOME::SALOME_Exception)
824 BEGIN_OF("MED_Mesh_i::addInStudy");
827 MESSAGE("Mesh already in Study");
828 THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study",
833 * SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
835 * // Create SComponent labelled 'MED' if it doesn't already exit
836 * SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
837 * if ( CORBA::is_nil(medfather) )
839 * MESSAGE("Add Component MED");
840 * medfather = myBuilder->NewComponent("MED");
841 * //myBuilder->AddAttribute (medfather,SALOMEDS::Name,"MED");
842 * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
843 * myBuilder->FindOrCreateAttribute(medfather, "AttributeName"));
844 * aName->SetValue("MED");
846 * myBuilder->DefineComponentInstance(medfather,myIor);
850 * MESSAGE("Add a mesh Object under MED");
851 * myBuilder->NewCommand();
852 * SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfather);
854 * ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
855 * ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
856 * CORBA::ORB_var &orb = init(0,0);
857 * string iorStr = orb->object_to_string(myIor);
858 * //myBuilder->AddAttribute(newObj,SALOMEDS::IOR,iorStr.c_str());
859 * SALOMEDS::AttributeIOR_var aIOR = SALOMEDS::AttributeIOR::_narrow(
860 * myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"));
861 * aIOR->SetValue(iorStr.c_str());
863 * //myBuilder->AddAttribute(newObj,SALOMEDS::Name,_mesh_i->getName().c_str());
864 * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
865 * myBuilder->FindOrCreateAttribute(newObj, "AttributeName"));
866 * aName->SetValue(_mesh_i->getName().c_str());
868 * _meshId = newObj->GetID();
869 * myBuilder->CommitCommand();
872 END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
875 //=============================================================================
877 * CORBA: write mesh in a med file
879 //=============================================================================
880 void SMESH_MEDMesh_i::write(CORBA::Long i, const char *driverMeshName)
881 throw(SALOME::SALOME_Exception)
883 MESSAGE("Non Implemente");
884 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
887 //=============================================================================
889 * CORBA: read mesh in a med file
891 //=============================================================================
892 void SMESH_MEDMesh_i::read(CORBA::Long i) throw(SALOME::SALOME_Exception)
894 MESSAGE("Non Implemente");
895 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
898 //=============================================================================
900 * CORBA : release driver
902 //=============================================================================
903 void SMESH_MEDMesh_i::rmDriver(CORBA::Long i) throw(SALOME::SALOME_Exception)
905 MESSAGE("Non Implemente");
906 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
909 //=============================================================================
911 * CORBA : attach driver
913 //=============================================================================
914 CORBA::Long SMESH_MEDMesh_i::addDriver(SALOME_MED::medDriverTypes driverType,
915 const char *fileName, const char *meshName) throw(SALOME::SALOME_Exception)
917 MESSAGE("Non Implemente");
918 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
922 //=============================================================================
924 * Calcule le Nb d'elements par entite geometrique
926 //=============================================================================
927 void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception)
933 _mapNbTypes[SALOME_MED::MED_NODE] = 1;
934 // On compte les aretes MED_SEG2 ou MED_SEG3
935 // On range les elements dans les vecteurs correspondants
937 _mapIndToSeqElts[SALOME_MED::MED_SEG2] = _indexElts++;
938 _mapIndToSeqElts[SALOME_MED::MED_SEG3] = _indexElts++;
939 _mapIndToVectTypes[SALOME_MED::MED_EDGE] = _indexEnts++;
943 SALOME_MED::medGeometryElement medElement;
945 SMDS_Iterator<const SMDS_MeshEdge*> * itEdges=_meshDS->edgesIterator();
946 while(itEdges->more())
948 const SMDS_MeshEdge* elem = itEdges->next();
949 int nb_of_nodes = elem->NbNodes();
955 medElement = SALOME_MED::MED_SEG2;
959 _TypesId[SALOME_MED::MED_EDGE].
960 push_back(SALOME_MED::MED_SEG2);
966 medElement = SALOME_MED::MED_SEG3;
970 _TypesId[SALOME_MED::MED_EDGE].
971 push_back(SALOME_MED::MED_SEG3);
976 int index = _mapIndToSeqElts[medElement];
978 // Traitement de l arete
979 int longueur = _seq_elemId[index]->length();
980 _seq_elemId[index]->length(longueur + nb_of_nodes);
982 SMDS_Iterator<const SMDS_MeshNode*> * itn=_meshDS->nodesIterator();
984 for(int k=0; itn->more(); k++)
985 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
990 _mapNbTypes[SALOME_MED::MED_EDGE] = trouveSeg2 + trouveSeg3;
992 // On compte les faces MED_TRIA3, MED_HEXA8, MED_TRIA6
993 // On range les elements dans les vecteurs correspondants
998 _mapIndToSeqElts[SALOME_MED::MED_TRIA3] = _indexElts++;
999 _mapIndToSeqElts[SALOME_MED::MED_TRIA6] = _indexElts++;
1000 _mapIndToSeqElts[SALOME_MED::MED_QUAD4] = _indexElts++;
1001 _mapIndToVectTypes[SALOME_MED::MED_FACE] = _indexEnts++;
1003 SMDS_Iterator<const SMDS_MeshFace*> * itFaces=_meshDS->facesIterator();
1004 while(itFaces->more())
1006 const SMDS_MeshFace * elem = itFaces->next();
1007 int nb_of_nodes = elem->NbNodes();
1009 switch (nb_of_nodes)
1013 medElement = SALOME_MED::MED_TRIA3;
1014 if (trouveTria3 == 0)
1017 _TypesId[SALOME_MED::MED_FACE].
1018 push_back(SALOME_MED::MED_TRIA3);
1024 medElement = SALOME_MED::MED_QUAD4;
1025 if (trouveQuad4 == 0)
1028 _TypesId[SALOME_MED::MED_FACE].
1029 push_back(SALOME_MED::MED_QUAD4);
1035 medElement = SALOME_MED::MED_TRIA6;
1036 if (trouveTria6 == 0)
1039 _TypesId[SALOME_MED::MED_FACE].
1040 push_back(SALOME_MED::MED_TRIA6);
1045 int index = _mapIndToSeqElts[medElement];
1048 // Traitement de la face
1049 // Attention La numérotation des noeuds Med commence a 1
1051 int longueur = _seq_elemId[index]->length();
1052 _seq_elemId[index]->length(longueur + nb_of_nodes);
1054 SMDS_Iterator<const SMDS_MeshNode*> * itn=_meshDS->nodesIterator();
1056 for(int k=0; itn->more(); k++)
1057 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
1062 _mapNbTypes[SALOME_MED::MED_FACE] =
1063 trouveTria3 + trouveTria6 + trouveQuad4;
1065 _mapIndToSeqElts[SALOME_MED::MED_HEXA8] = _indexElts++;
1066 _mapIndToVectTypes[SALOME_MED::MED_CELL] = _indexEnts++;
1067 int index = _mapIndToSeqElts[medElement];
1069 int trouveHexa8 = 0;
1071 SMDS_Iterator<const SMDS_MeshVolume*> * itVolumes=_meshDS->volumesIterator();
1072 while(itVolumes->more())
1074 const SMDS_MeshVolume * elem = itVolumes->next();
1076 int nb_of_nodes = elem->NbNodes();
1077 medElement = SALOME_MED::MED_HEXA8;
1078 ASSERT(nb_of_nodes = 8);
1080 if (trouveHexa8 == 0)
1083 _TypesId[SALOME_MED::MED_CELL].push_back(SALOME_MED::MED_HEXA8);
1085 // Traitement de la maille
1086 int longueur = _seq_elemId[index]->length();
1087 _seq_elemId[index]->length(longueur + nb_of_nodes);
1089 SMDS_Iterator<const SMDS_MeshNode*> * itn=_meshDS->nodesIterator();
1090 for(int k=0; itn->more(); k++)
1091 _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
1096 _mapNbTypes[SALOME_MED::MED_CELL] = trouveHexa8;
1097 _mapNbTypes[SALOME_MED::MED_ALL_ENTITIES]
1099 trouveHexa8 + trouveTria3 + trouveTria6 + trouveQuad4 + trouveSeg2 +
1104 //=============================================================================
1106 * Creation des familles
1108 //=============================================================================
1109 void SMESH_MEDMesh_i::createFamilies() throw(SALOME::SALOME_Exception)
1111 string famDes = ("Je ne sais pas");
1112 string famName0 = "Famille_";
1116 if (_creeFamily == false)
1119 SMESH_subMesh_i *subMeshServant;
1121 map < int, SMESH_subMesh_i * >::iterator it;
1122 for (it = _mesh_i->_mapSubMesh_i.begin();
1123 it != _mesh_i->_mapSubMesh_i.end(); it++)
1125 SMESH_subMesh_i *submesh_i = (*it).second;
1126 int famIdent = (*it).first;
1128 ASSERT(famIdent < 999999999);
1129 sprintf(numero, "%d\n", famIdent);
1130 famName = famName0 + numero;
1132 SMESH_MEDFamily_i *famservant =
1133 new SMESH_MEDFamily_i(famIdent, submesh_i,
1134 famName, famDes, SALOME_MED::MED_NODE);
1135 SALOME_MED::FAMILY_ptr famille =
1136 SALOME_MED::FAMILY::_narrow(famservant->
1137 POA_SALOME_MED::FAMILY::_this());
1138 _families.push_back(famille);
1142 //=============================================================================
1144 * Gives informations of the considered mesh.
1146 //=============================================================================
1147 SALOME_MED::MESH::meshInfos * SMESH_MEDMesh_i::getMeshGlobal()
1148 throw (SALOME::SALOME_Exception)
1150 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1152 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1156 //=============================================================================
1158 * Gives informations on coordinates of the considered mesh.
1160 //=============================================================================
1161 SALOME_MED::MESH::coordinateInfos * SMESH_MEDMesh_i::getCoordGlobal()
1162 throw (SALOME::SALOME_Exception)
1164 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1166 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1170 //=============================================================================
1172 * Gives informations on connectivities of the considered mesh for the entity
1175 //=============================================================================
1176 SALOME_MED::MESH::connectivityInfos *
1177 SMESH_MEDMesh_i::getConnectGlobal(SALOME_MED::medEntityMesh entity)
1178 throw (SALOME::SALOME_Exception)
1180 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1182 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
1186 //=============================================================================
1188 * Gives the type of the element number of entity entity
1190 //=============================================================================
1191 SALOME_MED::medGeometryElement
1192 SMESH_MEDMesh_i::getElementType(SALOME_MED::medEntityMesh entity,
1194 throw (SALOME::SALOME_Exception)
1196 MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
1198 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);