2 //=============================================================================
3 // File : SMESH_MEDMesh_i.cxx
5 // Copyright : EDF 2001
6 //=============================================================================
8 #include "SMESH_MEDMesh_i.hxx"
9 #include "SMESH_Mesh_i.hxx"
11 #include "SMESHDS_Mesh.hxx"
12 #include "SMESHDS_SubMesh.hxx"
14 #include "SMDS_MapIteratorOfExtendedMap.hxx"
15 #include "SMDS_MapOfMeshElement.hxx"
18 #include <TopExp_Explorer.hxx>
20 #include <TopoDS_Iterator.hxx>
21 #include <TopoDS_Compound.hxx>
22 #include <TopoDS_CompSolid.hxx>
23 #include <TopoDS_Solid.hxx>
24 #include <TopoDS_Shell.hxx>
25 #include <TopoDS_Face.hxx>
26 #include <TopoDS_Wire.hxx>
27 #include <TopoDS_Edge.hxx>
28 #include <TopoDS_Vertex.hxx>
29 #include <TopoDS_Shape.hxx>
30 #include <TopTools_MapOfShape.hxx>
32 #include "utilities.h"
33 #include "Utils_CorbaException.hxx"
35 #include "SMESH_MEDSupport_i.hxx"
36 #include "SMESH_MEDFamily_i.hxx"
38 # include "Utils_ORB_INIT.hxx"
39 # include "Utils_SINGLETON.hxx"
46 //=============================================================================
50 //=============================================================================
51 // PN Est-ce un const ?
52 SMESH_MEDMesh_i::SMESH_MEDMesh_i()
54 BEGIN_OF("Default Constructor SMESH_MEDMesh_i");
55 END_OF("Default Constructor SMESH_MEDMesh_i");
57 //=============================================================================
61 //=============================================================================
62 SMESH_MEDMesh_i::~SMESH_MEDMesh_i()
65 //=============================================================================
69 //=============================================================================
70 SMESH_MEDMesh_i::SMESH_MEDMesh_i( ::SMESH_Mesh_i* m_i ) :_meshId(""),
78 _meshDS = _mesh_i->GetImpl().GetMeshDS();
80 BEGIN_OF("Constructor SMESH_MEDMesh_i");
81 END_OF("Constructor SMESH_MEDMesh_i");
84 //=============================================================================
86 * CORBA: Accessor for Name
88 //=============================================================================
89 char * SMESH_MEDMesh_i::getName()
90 throw (SALOME::SALOME_Exception)
93 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
94 SALOME::INTERNAL_ERROR);
98 // A COMPLETER PAR LE NOM DU MAILLAGE
99 //return CORBA::string_dup(_mesh_i->getName().c_str());
100 return CORBA::string_dup("toto");
104 MESSAGE("Exception en accedant au nom");
105 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
106 ,SALOME::INTERNAL_ERROR);
109 //=============================================================================
111 * CORBA: Accessor for corbaindex cuisine interne
113 //=============================================================================
114 CORBA::Long SMESH_MEDMesh_i::getCorbaIndex()
115 throw (SALOME::SALOME_Exception)
117 MESSAGE("Non Implemente");
118 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\
121 //=============================================================================
123 * CORBA: Accessor for Space Dimension
125 //=============================================================================
126 CORBA::Long SMESH_MEDMesh_i::getSpaceDimension()
127 throw (SALOME::SALOME_Exception)
129 // PN : Il semblerait que la dimension soit fixee a 3
131 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
132 SALOME::INTERNAL_ERROR);
135 //=============================================================================
137 * CORBA: Accessor for Mesh Dimension
139 //=============================================================================
140 CORBA::Long SMESH_MEDMesh_i::getMeshDimension()
141 throw (SALOME::SALOME_Exception)
144 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
145 SALOME::INTERNAL_ERROR);
146 // PN : Il semblerait que la dimension soit fixee a 3
148 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
149 SALOME::INTERNAL_ERROR);
152 //=============================================================================
154 * CORBA: Accessor for Coordinates System
156 //=============================================================================
157 char * SMESH_MEDMesh_i::getCoordinateSystem()
158 throw (SALOME::SALOME_Exception)
161 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
162 SALOME::INTERNAL_ERROR);
163 // PN : En dur. Non encore prevu
166 string systcoo="CARTESIEN";
167 return CORBA::string_dup(systcoo.c_str());
171 MESSAGE("Exception en accedant au maillage");
172 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
173 ,SALOME::INTERNAL_ERROR);
176 //=============================================================================
178 * CORBA: Accessor for Coordinates
180 //=============================================================================
181 Engines::double_array * SMESH_MEDMesh_i::getCoordinates(SALOME_MED::medModeSwitch typeSwitch)
182 throw (SALOME::SALOME_Exception)
185 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
186 SALOME::INTERNAL_ERROR);
187 Engines::double_array_var myseq = new Engines::double_array;
191 int spaceDimension=3;
192 int nbNodes=_meshDS->NbNodes();
194 myseq->length(nbNodes*spaceDimension);
196 SMDS_MeshNodesIterator itNodes(_meshDS);
197 for (;itNodes.More();itNodes.Next())
200 const Handle(SMDS_MeshElement)& elem = itNodes.Value();
201 const Handle(SMDS_MeshNode)& node =_meshDS->GetNode(1,elem);
203 if (typeSwitch == SALOME_MED::MED_FULL_INTERLACE)
205 myseq[i*3]=node->X();
206 myseq[i*3+1]=node->Y();
207 myseq[i*3+2]=node->Z();
209 SCRUTE(myseq[i*3+1]);
210 SCRUTE(myseq[i*3+2]);
214 ASSERT(typeSwitch == SALOME_MED::MED_NO_INTERLACE);
216 myseq[i+nbNodes]=node->Y();
217 myseq[i+(nbNodes*2)]=node->Z();
219 SCRUTE(myseq[i+nbNodes]);
220 SCRUTE(myseq[i+(nbNodes*2)]);
227 MESSAGE("Exception en accedant aux coordonnees");
228 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
229 ,SALOME::INTERNAL_ERROR);
231 return myseq._retn();
233 //=============================================================================
235 * CORBA: Accessor for Coordinates Names
237 //=============================================================================
238 Engines::string_array * SMESH_MEDMesh_i::getCoordinatesNames()
239 throw (SALOME::SALOME_Exception)
242 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
243 SALOME::INTERNAL_ERROR);
244 Engines::string_array_var myseq = new Engines::string_array;
248 int spaceDimension=3;
249 myseq->length(spaceDimension);
250 myseq[0]=CORBA::string_dup("x");
251 myseq[1]=CORBA::string_dup("y");
252 myseq[2]=CORBA::string_dup("z");
256 MESSAGE("Exception en accedant aux noms des coordonnees");
257 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
258 ,SALOME::INTERNAL_ERROR);
260 return myseq._retn();
263 //=============================================================================
265 * CORBA: Accessor for Coordinates Units
267 //=============================================================================
268 Engines::string_array * SMESH_MEDMesh_i::getCoordinatesUnits()
269 throw (SALOME::SALOME_Exception)
272 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
273 SALOME::INTERNAL_ERROR);
274 Engines::string_array_var myseq = new Engines::string_array;
278 int spaceDimension=3;
279 myseq->length(spaceDimension);
280 myseq[0]=CORBA::string_dup("m");
281 myseq[1]=CORBA::string_dup("m");
282 myseq[2]=CORBA::string_dup("m");
286 MESSAGE("Exception en accedant aux unites des coordonnees");
287 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
288 ,SALOME::INTERNAL_ERROR);
290 return myseq._retn();
292 //=============================================================================
294 * CORBA: Accessor for Number of Nodes
296 //=============================================================================
297 CORBA::Long SMESH_MEDMesh_i::getNumberOfNodes()
298 throw (SALOME::SALOME_Exception)
301 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
302 SALOME::INTERNAL_ERROR);
305 return _meshDS->NbNodes();
309 MESSAGE("Exception en accedant au nombre de noeuds");
310 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
311 ,SALOME::INTERNAL_ERROR);
314 //=============================================================================
316 * CORBA: Accessor for number of Types
318 //=============================================================================
319 CORBA::Long SMESH_MEDMesh_i::getNumberOfTypes(SALOME_MED::medEntityMesh entity)
320 throw (SALOME::SALOME_Exception)
323 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
324 SALOME::INTERNAL_ERROR);
330 if ( _mapNbTypes.find(entity)!=_mapNbTypes.end())
331 retour=_mapNbTypes[entity];
336 MESSAGE("Exception en accedant au nombre de Types");
337 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
338 ,SALOME::INTERNAL_ERROR);
342 //=============================================================================
344 * CORBA: Accessor for existing geometry element types
345 * Not implemented for MED_ALL_ENTITIES
347 //=============================================================================
348 SALOME_MED::medGeometryElement_array * SMESH_MEDMesh_i::getTypes (SALOME_MED::medEntityMesh entity)
349 throw (SALOME::SALOME_Exception)
352 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
353 SALOME::INTERNAL_ERROR);
354 if (entity ==SALOME_MED::MED_ALL_ENTITIES)
355 THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ENTITIES",\
359 SALOME_MED::medGeometryElement_array_var myseq =
360 new SALOME_MED::medGeometryElement_array;
363 if ( _mapNbTypes.find(entity) ==_mapNbTypes.end())
364 THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh"\
366 int nbTypes=_mapNbTypes[entity];
368 myseq->length(nbTypes);
370 if ( _mapIndToVectTypes.find(entity) ==_mapIndToVectTypes.end())
371 THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh"\
372 ,SALOME::INTERNAL_ERROR);
374 int index=_mapIndToVectTypes[entity];
375 ASSERT( _TypesId[index].size()!=0);
377 vector<SALOME_MED::medGeometryElement>::iterator it;
378 for (it=_TypesId[index].begin();it!=_TypesId[index].end();it++)
385 MESSAGE("Exception en accedant aux differents types");
386 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
387 ,SALOME::INTERNAL_ERROR);
389 return myseq._retn();
391 //=============================================================================
393 * CORBA: Returns number of elements of type medGeometryElement
394 * Not implemented for MED_ALL_ELEMENTS
395 * implemented for MED_ALL_ENTITIES
397 * Dans cette implementation, il n est pas prevu de tenir compte du entity
398 * qui ne doit pas pouvoir avoir deux valeurs differentes pour un geomElement
400 //=============================================================================
401 CORBA::Long SMESH_MEDMesh_i::getNumberOfElements(SALOME_MED::medEntityMesh entity,
402 SALOME_MED::medGeometryElement geomElement)
403 throw (SALOME::SALOME_Exception)
406 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
407 SALOME::INTERNAL_ERROR);
408 if (geomElement == SALOME_MED::MED_ALL_ELEMENTS)
409 THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ELEMENTS", \
417 if ( _mapIndToSeqElts.find(geomElement)!=_mapIndToSeqElts.end())
419 int index = _mapIndToSeqElts[geomElement];
420 retour=_seq_elemId[index]->length();
426 MESSAGE("Exception en accedant au nombre d élements");
427 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
428 ,SALOME::INTERNAL_ERROR);
431 //=============================================================================
433 * CORBA: Accessor for connectivities
435 //=============================================================================
436 Engines::long_array * SMESH_MEDMesh_i::getConnectivity(SALOME_MED::medModeSwitch typeSwitch,
437 SALOME_MED::medConnectivity mode,
438 SALOME_MED::medEntityMesh entity,
439 SALOME_MED::medGeometryElement geomElement)
440 throw (SALOME::SALOME_Exception)
443 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
444 SALOME::INTERNAL_ERROR);
445 if (mode != SALOME_MED::MED_NODAL)
446 THROW_SALOME_CORBA_EXCEPTION("Not Implemented",\
448 if (typeSwitch == SALOME_MED::MED_NO_INTERLACE)
449 THROW_SALOME_CORBA_EXCEPTION("Not Yet Implemented",\
454 // Faut-il renvoyer un pointeur vide ???
455 if ( _mapIndToSeqElts.find(geomElement)!=_mapIndToSeqElts.end())
456 THROW_SALOME_CORBA_EXCEPTION("No Such Element in the mesh"\
459 int index=_mapIndToSeqElts[geomElement];
460 return _seq_elemId[index]._retn();
462 //=============================================================================
464 * CORBA: Accessor for connectivities
466 //=============================================================================
467 Engines::long_array* SMESH_MEDMesh_i::getConnectivityIndex(SALOME_MED::medConnectivity mode,
468 SALOME_MED::medEntityMesh entity)
469 throw (SALOME::SALOME_Exception)
471 MESSAGE("Pas Implemente dans SMESH");
472 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\
476 //=============================================================================
478 * CORBA: Find an element corresponding to the given connectivity
480 //=============================================================================
481 CORBA::Long SMESH_MEDMesh_i::getElementNumber(SALOME_MED::medConnectivity mode,
482 SALOME_MED::medEntityMesh entity,
483 SALOME_MED::medGeometryElement type,
484 const Engines::long_array & connectivity
486 throw (SALOME::SALOME_Exception)
488 const char * LOC = "getElementNumber ";
489 MESSAGE(LOC<<"Pas Implemente dans SMESH");
490 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\
494 //=============================================================================
496 * CORBA: Accessor for Ascendant connectivities
497 * not implemented for MED_ALL_ENTITIES and MED_MAILLE
499 //=============================================================================
500 Engines::long_array* SMESH_MEDMesh_i::getReverseConnectivity(SALOME_MED::medConnectivity mode)
501 throw (SALOME::SALOME_Exception)
503 MESSAGE("Pas Implemente dans SMESH");
504 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\
508 //=============================================================================
510 * CORBA: Accessor for connectivities
512 //=============================================================================
513 Engines::long_array* SMESH_MEDMesh_i::getReverseConnectivityIndex(SALOME_MED::medConnectivity mode)
514 throw (SALOME::SALOME_Exception)
516 MESSAGE("Pas Implemente dans SMESH");
517 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\
521 //=============================================================================
523 * CORBA: Returns number of families within the mesh
525 //=============================================================================
526 CORBA::Long SMESH_MEDMesh_i::getNumberOfFamilies(SALOME_MED::medEntityMesh entity)
527 throw (SALOME::SALOME_Exception)
529 if (_creeFamily == false)
532 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
533 SALOME::INTERNAL_ERROR);
534 return _families.size();
536 //=============================================================================
538 * CORBA: Returns number of groups within the mesh
540 //=============================================================================
541 CORBA::Long SMESH_MEDMesh_i::getNumberOfGroups(SALOME_MED::medEntityMesh entity)
542 throw (SALOME::SALOME_Exception)
545 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
546 SALOME::INTERNAL_ERROR);
547 MESSAGE(" Pas d implementation des groupes dans SMESH");
550 //=============================================================================
552 * CORBA: Returns references for families within the mesh
554 //=============================================================================
555 SALOME_MED::Family_array * SMESH_MEDMesh_i::getFamilies(SALOME_MED::medEntityMesh entity)
556 throw (SALOME::SALOME_Exception)
558 if (_creeFamily == false)
561 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
562 SALOME::INTERNAL_ERROR);
563 SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array;
564 int nbfam= _families.size();
565 myseq->length(nbfam);
567 vector<SALOME_MED::FAMILY_ptr>::iterator it;
568 for (it=_families.begin();it!=_families.end();it++)
572 return myseq._retn();
574 //=============================================================================
576 * CORBA: Returns references for family i within the mesh
578 //=============================================================================
579 SALOME_MED::FAMILY_ptr SMESH_MEDMesh_i::getFamily(SALOME_MED::medEntityMesh entity,
581 throw (SALOME::SALOME_Exception)
583 if (_creeFamily == false)
586 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
587 SALOME::INTERNAL_ERROR);
589 SCRUTE(_families[i]->getName());
590 MESSAGE ( " SMESH_MEDMesh_i::getFamily " << i )
593 //=============================================================================
595 * CORBA: Returns references for groups within the mesh
597 //=============================================================================
598 SALOME_MED::Group_array * SMESH_MEDMesh_i::getGroups(SALOME_MED::medEntityMesh entity)
599 throw (SALOME::SALOME_Exception)
602 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
603 SALOME::INTERNAL_ERROR);
604 MESSAGE(" Pas d implementation des groupes dans SMESH");
605 THROW_SALOME_CORBA_EXCEPTION("No group implementation"\
608 //=============================================================================
610 * CORBA: Returns references for group i within the mesh
612 //=============================================================================
613 SALOME_MED::GROUP_ptr SMESH_MEDMesh_i::getGroup(SALOME_MED::medEntityMesh entity,
615 throw (SALOME::SALOME_Exception)
618 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
619 SALOME::INTERNAL_ERROR);
620 MESSAGE(" Pas d implementation des groupes dans SMESH");
621 THROW_SALOME_CORBA_EXCEPTION("No group implementation"\
624 //=============================================================================
628 //=============================================================================
629 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getVolume(SALOME_MED::SUPPORT_ptr mySupport)
630 throw (SALOME::SALOME_Exception)
632 MESSAGE("Pas Implemente dans SMESH");
633 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\
637 //=============================================================================
641 //=============================================================================
642 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getArea(SALOME_MED::SUPPORT_ptr mySupport)
643 throw (SALOME::SALOME_Exception)
645 MESSAGE("Pas Implemente dans SMESH");
646 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\
650 //=============================================================================
654 //=============================================================================
655 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getLength(SALOME_MED::SUPPORT_ptr mySupport)
656 throw (SALOME::SALOME_Exception)
658 MESSAGE("Pas Implemente dans SMESH");
659 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\
663 //=============================================================================
667 //=============================================================================
668 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNormal(SALOME_MED::SUPPORT_ptr mySupport)
669 throw (SALOME::SALOME_Exception)
671 MESSAGE("Pas Implemente dans SMESH");
672 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\
676 //=============================================================================
680 //=============================================================================
681 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getBarycenter(SALOME_MED::SUPPORT_ptr mySupport)
682 throw (SALOME::SALOME_Exception)
684 MESSAGE("Pas Implemente dans SMESH");
685 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\
689 //=============================================================================
693 //=============================================================================
694 SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNeighbourhood(SALOME_MED::SUPPORT_ptr mySupport)
695 throw (SALOME::SALOME_Exception)
697 MESSAGE("Non Implemente");
698 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\
702 //=============================================================================
704 * CORBA: add the Mesh in the StudyManager
707 //=============================================================================
708 void SMESH_MEDMesh_i::addInStudy(SALOMEDS::Study_ptr myStudy,
709 SALOME_MED::MESH_ptr myIor)
710 throw (SALOME::SALOME_Exception)
712 BEGIN_OF("MED_Mesh_i::addInStudy");
715 MESSAGE("Mesh already in Study");
716 THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study", \
721 SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
723 // Create SComponent labelled 'MED' if it doesn't already exit
724 SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
725 if ( CORBA::is_nil(medfather) )
727 MESSAGE("Add Component MED");
728 medfather = myBuilder->NewComponent("MED");
729 //myBuilder->AddAttribute (medfather,SALOMEDS::Name,"MED");
730 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
731 myBuilder->FindOrCreateAttribute(medfather, "AttributeName"));
732 aName->SetValue("MED");
734 myBuilder->DefineComponentInstance(medfather,myIor);
738 MESSAGE("Add a mesh Object under MED");
739 myBuilder->NewCommand();
740 SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfather);
742 ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
743 ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
744 CORBA::ORB_var &orb = init(0,0);
745 string iorStr = orb->object_to_string(myIor);
746 //myBuilder->AddAttribute(newObj,SALOMEDS::IOR,iorStr.c_str());
747 SALOMEDS::AttributeIOR_var aIOR = SALOMEDS::AttributeIOR::_narrow(
748 myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"));
749 aIOR->SetValue(iorStr.c_str());
751 //myBuilder->AddAttribute(newObj,SALOMEDS::Name,_mesh_i->getName().c_str());
752 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
753 myBuilder->FindOrCreateAttribute(newObj, "AttributeName"));
754 aName->SetValue(_mesh_i->getName().c_str());
756 _meshId = newObj->GetID();
757 myBuilder->CommitCommand();
760 END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
762 //=============================================================================
764 * CORBA: write mesh in a med file
766 //=============================================================================
767 void SMESH_MEDMesh_i::write(CORBA::Long i, const char* driverMeshName)
768 throw (SALOME::SALOME_Exception)
770 MESSAGE("Non Implemente");
771 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\
774 //=============================================================================
776 * CORBA: read mesh in a med file
778 //=============================================================================
779 void SMESH_MEDMesh_i::read(CORBA::Long i)
780 throw (SALOME::SALOME_Exception)
782 MESSAGE("Non Implemente");
783 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\
786 //=============================================================================
788 * CORBA : release driver
790 //=============================================================================
791 void SMESH_MEDMesh_i::rmDriver(CORBA::Long i)
792 throw (SALOME::SALOME_Exception)
794 MESSAGE("Non Implemente");
795 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\
798 //=============================================================================
800 * CORBA : attach driver
802 //=============================================================================
803 CORBA::Long SMESH_MEDMesh_i::addDriver(SALOME_MED::medDriverTypes driverType,
804 const char* fileName, const char* meshName)
805 throw (SALOME::SALOME_Exception)
807 MESSAGE("Non Implemente");
808 THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\
812 //=============================================================================
814 * Calcule le Nb d'elements par entite geometrique
816 //=============================================================================
817 void SMESH_MEDMesh_i::calculeNbElts()
818 throw (SALOME::SALOME_Exception)
824 _mapNbTypes[SALOME_MED::MED_NODE]=1;
825 // On compte les aretes MED_SEG2 ou MED_SEG3
826 // On range les elements dans les vecteurs correspondants
828 _mapIndToSeqElts[SALOME_MED::MED_SEG2]=_indexElts++;
829 _mapIndToSeqElts[SALOME_MED::MED_SEG3]=_indexElts++;
830 _mapIndToVectTypes[SALOME_MED::MED_EDGE]=_indexEnts++;
834 SALOME_MED::medGeometryElement medElement;
835 SMDS_MeshEdgesIterator itEdges(_meshDS);
836 for (;itEdges.More();itEdges.Next())
838 const Handle(SMDS_MeshElement)& elem = itEdges.Value();
839 int nb_of_nodes = elem->NbNodes();
845 medElement=SALOME_MED::MED_SEG2;
849 _TypesId[SALOME_MED::MED_EDGE].push_back(SALOME_MED::MED_SEG2);
856 medElement=SALOME_MED::MED_SEG3;
860 _TypesId[SALOME_MED::MED_EDGE].push_back(SALOME_MED::MED_SEG3);
865 int index=_mapIndToSeqElts[medElement];
867 // Traitement de l arete
868 int longueur=_seq_elemId[index]->length();
869 _seq_elemId[index]->length(longueur + nb_of_nodes);
871 for (int k=0; k<nb_of_nodes; k++)
873 _seq_elemId[index][longueur+k]=elem->GetConnection(k+1) +1;
877 _mapNbTypes[SALOME_MED::MED_EDGE]=trouveSeg2 + trouveSeg3;
879 // On compte les faces MED_TRIA3, MED_HEXA8, MED_TRIA6
880 // On range les elements dans les vecteurs correspondants
885 _mapIndToSeqElts[SALOME_MED::MED_TRIA3]=_indexElts++;
886 _mapIndToSeqElts[SALOME_MED::MED_TRIA6]=_indexElts++;
887 _mapIndToSeqElts[SALOME_MED::MED_QUAD4]=_indexElts++;
888 _mapIndToVectTypes[SALOME_MED::MED_FACE]=_indexEnts++;
890 SMDS_MeshFacesIterator itFaces(_meshDS);
891 for (;itFaces.More();itFaces.Next())
894 const Handle(SMDS_MeshElement)& elem = itFaces.Value();
895 int nb_of_nodes = elem->NbNodes();
901 medElement=SALOME_MED::MED_TRIA3;
905 _TypesId[SALOME_MED::MED_FACE].push_back(SALOME_MED::MED_TRIA3);
911 medElement=SALOME_MED::MED_QUAD4;
915 _TypesId[SALOME_MED::MED_FACE].push_back(SALOME_MED::MED_QUAD4);
921 medElement=SALOME_MED::MED_TRIA6;
925 _TypesId[SALOME_MED::MED_FACE].push_back(SALOME_MED::MED_TRIA6);
930 int index=_mapIndToSeqElts[medElement];
933 // Traitement de la face
934 // Attention La numérotation des noeuds Med commence a 1
937 int longueur = _seq_elemId[index]->length();
938 _seq_elemId[index]->length(longueur+nb_of_nodes);
940 for (int k=0; k<nb_of_nodes; k++)
942 _seq_elemId[index][longueur+k]=elem->GetConnection(k+1) +1;
946 _mapNbTypes[SALOME_MED::MED_FACE]=trouveTria3 + trouveTria6 + trouveQuad4;
948 _mapIndToSeqElts[SALOME_MED::MED_HEXA8]=_indexElts++;
949 _mapIndToVectTypes[SALOME_MED::MED_CELL]=_indexEnts++;
950 int index=_mapIndToSeqElts[medElement];
953 SMDS_MeshVolumesIterator itVolumes(_meshDS);
954 for (;itVolumes.More();itVolumes.Next())
956 const Handle(SMDS_MeshElement)& elem = itVolumes.Value();
958 int nb_of_nodes = elem->NbNodes();
959 medElement=SALOME_MED::MED_HEXA8;
960 ASSERT(nb_of_nodes=8);
962 if (trouveHexa8 == 0)
965 _TypesId[SALOME_MED::MED_CELL].push_back(SALOME_MED::MED_HEXA8);
967 // Traitement de la maille
968 int longueur=_seq_elemId[index]->length();
969 _seq_elemId[index]->length(longueur+nb_of_nodes);
971 for (int k=0; k<nb_of_nodes; k++)
973 _seq_elemId[index][longueur+k]=elem->GetConnection(k+1) +1;
978 _mapNbTypes[SALOME_MED::MED_CELL]=trouveHexa8;
979 _mapNbTypes[SALOME_MED::MED_ALL_ENTITIES]
980 =trouveHexa8 + trouveTria3 + trouveTria6 + trouveQuad4 + trouveSeg2 + trouveSeg3 ;
981 } /* fin du _compte */
983 //=============================================================================
985 * Creation des familles
987 //=============================================================================
988 void SMESH_MEDMesh_i::createFamilies()
989 throw (SALOME::SALOME_Exception)
991 string famDes=("Je ne sais pas");
992 string famName0="Famille_";
996 if ( _creeFamily == false)
999 SMESH_subMesh_i* subMeshServant;
1001 map<int, SMESH_subMesh_i*>::iterator it;
1002 for (it = _mesh_i->_mapSubMesh_i.begin(); it != _mesh_i->_mapSubMesh_i.end(); it++) {
1003 SMESH_subMesh_i* submesh_i = (*it).second;
1004 int famIdent = (*it).first;
1006 ASSERT (famIdent<999999999);
1007 sprintf(numero,"%d\n",famIdent);
1008 famName=famName0 + numero;
1010 SMESH_MEDFamily_i * famservant= new SMESH_MEDFamily_i(famIdent, submesh_i,
1011 famName, famDes, SALOME_MED::MED_NODE);
1012 SALOME_MED::FAMILY_ptr famille =
1013 SALOME_MED::FAMILY::_narrow(famservant->POA_SALOME_MED::FAMILY::_this());
1014 _families.push_back(famille);
1016 } /* fin du _compte */