1 // VISU OBJECT : interactive object for VISU entities implementation
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 : VISU_CorbaMedConvertor.cxx
25 // Author : Alexey PETROV
28 // Copyright (C) 2003 CEA/DEN, EDF R&D
30 #include "VISU_CorbaMedConvertor.hxx"
32 #include <vtkCellType.h>
34 #include <boost/tuple/tuple.hpp>
39 #define USER_INTERLACE MED_FULL_INTERLACE
42 static int MYDEBUG = 1;
44 static int MYDEBUG = 0;
48 VISU_Convertor* CreateMEDConvertor(SALOMEDS::SObject_ptr theMedSObject) {
49 return new VISU_MEDConvertor(theMedSObject);
51 VISU_Convertor* CreateMEDFieldConvertor(SALOME_MED::FIELD_ptr theField) {
52 return new VISU_MEDFieldConvertor(theField);
57 using namespace SALOME_MED;
59 const int MED_NBR_GEOMETRIE_MAILLE = 15;
62 CELLGEOM[MED_NBR_GEOMETRIE_MAILLE] = {
80 const int MED_NBR_GEOMETRIE_FACE = 4;
83 FACEGEOM[MED_NBR_GEOMETRIE_FACE] = {
90 const int MED_NBR_GEOMETRIE_ARETE = 2;
93 EDGEGEOM[MED_NBR_GEOMETRIE_ARETE] = {
98 const int MED_NBR_GEOMETRIE_NODE = 1;
101 NODEGEOM[MED_NBR_GEOMETRIE_NODE] = {
105 int GetEntity2Geom(const VISU::TEntity& theEntity, medGeometryElement*& theVector)
108 case CELL_ENTITY: theVector = CELLGEOM; return MED_NBR_GEOMETRIE_MAILLE; break;
109 case FACE_ENTITY: theVector = FACEGEOM; return MED_NBR_GEOMETRIE_FACE; break;
110 case EDGE_ENTITY: theVector = EDGEGEOM; return MED_NBR_GEOMETRIE_ARETE; break;
111 case NODE_ENTITY: theVector = NODEGEOM; return MED_NBR_GEOMETRIE_NODE; break;
116 int MEDGeom2NbNodes(int theMEDGeomType)
118 switch(theMEDGeomType){
119 case MED_NONE: return 0;
120 case MED_POINT1: return 1;
121 case MED_SEG2: return 2;
122 case MED_SEG3: return 3;
123 case MED_TRIA3: return 3;
124 case MED_TRIA6: return 6;
125 case MED_QUAD4: return 4;
126 case MED_QUAD8: return 8;
127 case MED_TETRA4: return 4;
128 case MED_TETRA10: return 10;
129 case MED_HEXA8: return 8;
130 case MED_HEXA20: return 20;
131 case MED_PENTA6: return 6;
132 case MED_PENTA15: return 15;
133 case MED_PYRA5: return 5;
134 case MED_PYRA13: return 13;
139 int MEDGeomToVTK(medGeometryElement theMEDGeomType)
141 switch(theMEDGeomType){
142 case MED_NONE: return VTK_EMPTY_CELL;
143 case MED_POINT1: return VTK_VERTEX;
144 case MED_SEG2: return VTK_LINE;
145 case MED_SEG3: return VTK_LINE;
146 case MED_TRIA3: return VTK_TRIANGLE;
147 case MED_TRIA6: return VTK_TRIANGLE;
148 case MED_QUAD4: return VTK_QUAD;
149 case MED_QUAD8: return VTK_QUAD;
150 case MED_TETRA4: return VTK_TETRA;
151 case MED_TETRA10: return VTK_TETRA;
152 case MED_HEXA8: return VTK_HEXAHEDRON;
153 case MED_HEXA20: return VTK_HEXAHEDRON;
154 case MED_PENTA6: return VTK_WEDGE;
155 case MED_PENTA15: return VTK_WEDGE;
156 case MED_PYRA5: return VTK_PYRAMID;
157 case MED_PYRA13: return VTK_PYRAMID;
162 int VTKGeom2NbNodes(int theVTKGeomType)
164 switch(theVTKGeomType){
165 case VTK_VERTEX: return 1;
166 case VTK_LINE: return 2;
167 case VTK_TRIANGLE: return 3;
168 case VTK_QUAD: return 4;
169 case VTK_TETRA: return 4;
170 case VTK_HEXAHEDRON: return 8;
171 case VTK_WEDGE: return 6;
172 case VTK_PYRAMID: return 5;
177 medGeometryElement VTKGeomToMED(int theVTKGeomType)
179 switch(theVTKGeomType){
180 case VTK_VERTEX: return MED_POINT1;
181 case VTK_LINE: return MED_SEG2;
182 case VTK_TRIANGLE: return MED_TRIA3;
183 case VTK_QUAD: return MED_QUAD4;
184 case VTK_TETRA: return MED_TETRA4;
185 case VTK_HEXAHEDRON: return MED_HEXA8;
186 case VTK_WEDGE: return MED_PENTA6;
187 case VTK_PYRAMID: return MED_PYRA5;
189 return medGeometryElement(-1);
192 VISU::TEntity MEDEntityToVTK(medEntityMesh theMEDEntity)
194 switch(theMEDEntity){
195 case MED_NODE: return NODE_ENTITY;
196 case MED_EDGE: return EDGE_ENTITY;
197 case MED_FACE: return FACE_ENTITY;
198 case MED_CELL: return CELL_ENTITY;
200 return VISU::TEntity(-1);
203 medEntityMesh VTKEntityToMED(VISU::TEntity theVTKEntity)
205 switch(theVTKEntity){
206 case NODE_ENTITY: return MED_NODE;
207 case EDGE_ENTITY: return MED_EDGE;
208 case FACE_ENTITY: return MED_FACE;
209 case CELL_ENTITY: return MED_CELL;
211 return medEntityMesh(-1);
214 string GetSObjectName(SALOMEDS::SObject_ptr aSObject){
215 SALOMEDS::GenericAttribute_var anAttr;
216 if (aSObject->FindAttribute(anAttr,"AttributeName")) {
217 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
218 CORBA::String_var aString = aName->Value();
225 GetCellsSize(vtkIdType& theNbCells, vtkIdType& theCellsSize,
226 SALOME_MED::MESH_ptr theMEDMesh,
227 const VISU::TEntity& theVEntity)
229 medGeometryElement* aGeomElems;
230 theNbCells = theCellsSize = 0;
231 int iGeomEnd = GetEntity2Geom(theVEntity,aGeomElems);
232 const medEntityMesh& aMEntity = VTKEntityToMED(theVEntity);
233 if(MYDEBUG) MESSAGE("GetCellsSize - theVEntity = "<<theVEntity);
234 for(int iGeom = 0; iGeom < iGeomEnd; iGeom++){
235 medGeometryElement aMEDGeom = aGeomElems[iGeom];
236 int iNumElemEnd = theMEDMesh->getNumberOfElements(aMEntity,aMEDGeom);
238 if(MYDEBUG) MESSAGE("GetCellsSize - iNumElemEnd = "<<iNumElemEnd);
239 theCellsSize += iNumElemEnd*(MEDGeom2NbNodes(aMEDGeom) + 1);
240 theNbCells += iNumElemEnd;
247 GetCellsSize(vtkIdType& theNbCells, vtkIdType& theCellsSize,
248 SALOME_MED::FAMILY_ptr theMEDFamily)
250 medGeometryElement_array_var aGeom = theMEDFamily->getTypes();
251 int iGeomEnd = aGeom->length();
252 theNbCells = theCellsSize = 0;
253 if(MYDEBUG) MESSAGE("GetCellsSize - iGeomEnd = "<<iGeomEnd);
254 for(int iGeom = 0; iGeom < iGeomEnd; iGeom++) {
255 medGeometryElement aMEDGeom = aGeom[iGeom];
256 long_array_var aCellNumForType = theMEDFamily->getNumber(aMEDGeom);
257 int iNumElemEnd = aCellNumForType->length();
259 if(MYDEBUG) MESSAGE("GetCellsSize - iNumElemEnd = "<<iNumElemEnd);
260 theNbCells += iNumElemEnd;
261 theCellsSize += iNumElemEnd*(MEDGeom2NbNodes(aMEDGeom) + 1);
268 GetCellsSize(VISU::PCMesh theMesh,
269 SALOME_MED::MESH_ptr theMEDMesh,
270 const VISU::TEntity& theEntity)
272 TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
273 VISU::PCMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[theEntity];
274 if(theEntity == NODE_ENTITY){
275 theMesh->myNbPoints = theMEDMesh->getNumberOfNodes();
276 aMeshOnEntity->myNbCells = theMesh->myNbPoints;
277 aMeshOnEntity->myCellsSize = 2*theMesh->myNbPoints;
278 vtkIdType aNbCells, aCellsSize;
279 GetCellsSize(aNbCells,aCellsSize,theMEDMesh,CELL_ENTITY);
281 PCMeshOnEntity aMeshOnCells = aMeshOnEntityMap[CELL_ENTITY];
282 aMeshOnCells->myEntity = VISU::CELL_ENTITY;
283 aMeshOnCells->myMeshName = theMesh->myName;
284 aMeshOnCells->myNbCells = aNbCells;
285 aMeshOnCells->myCellsSize = aCellsSize;
288 GetCellsSize(aMeshOnEntity->myNbCells,aMeshOnEntity->myCellsSize,theMEDMesh,theEntity);
295 VISU_MEDFieldConvertor::Build()
297 if(myField->_is_nil())
298 throw std::runtime_error("VISU_MEDFieldConvertor::Build >> myField->_is_nil() !!!");
300 SALOME_MED::SUPPORT_var aMEDSupport = myField->getSupport();
301 if(aMEDSupport->_is_nil())
302 throw std::runtime_error("VISU_MEDFieldConvertor::Build >> aMEDSupport->_is_nil() !!!");
304 SALOME_MED::medEntityMesh aMEntity = aMEDSupport->getEntity();
305 TEntity aVEntity = MEDEntityToVTK(aMEntity);
306 SALOME_MED::MESH_var aMEDMesh = aMEDSupport->getMesh();
307 if(aMEDMesh->_is_nil())
308 throw std::runtime_error("VISU_MEDFieldConvertor::Build >> aMEDMesh->_is_nil() !!!");
310 CORBA::String_var aMeshName = aMEDMesh->getName();
311 CORBA::String_var aFieldName = myField->getName();
313 PCMesh aMesh = myMeshMap[aMeshName.in()](new TCMesh());
314 aMesh->myDim = aMEDMesh->getSpaceDimension();
315 aMesh->myPointsDim.resize(aMesh->myDim);
316 aMesh->myName = aMeshName.in();
317 aMesh->myMesh = aMEDMesh;
319 if(MYDEBUG) MESSAGE("VISU_MEDFieldConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh->myDim);
321 TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
322 PCMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TCMeshOnEntity());
323 aMeshOnEntity->myEntity = aVEntity;
324 aMeshOnEntity->myMeshName = aMeshName.in();
325 aMeshOnEntity->mySupport = aMEDSupport;
327 if(aVEntity == NODE_ENTITY){
328 PCMeshOnEntity aMeshOnEntity2 = aMeshOnEntityMap[CELL_ENTITY](new TCMeshOnEntity());
329 *aMeshOnEntity2 = *aMeshOnEntity;
330 aMeshOnEntity->myEntity = CELL_ENTITY;
331 GetCellsSize(aMesh,aMEDMesh,CELL_ENTITY);
333 PCMeshOnEntity aMeshOnEntity2 = aMeshOnEntityMap[NODE_ENTITY](new TCMeshOnEntity());
334 *aMeshOnEntity2 = *aMeshOnEntity;
335 aMeshOnEntity->myEntity = NODE_ENTITY;
336 GetCellsSize(aMesh,aMEDMesh,NODE_ENTITY);
338 GetCellsSize(aMesh,aMEDMesh,aVEntity);
340 TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
341 PCField aField = aFieldMap[aFieldName.in()](new TCField());
342 aField->myId = myField->getOrderNumber();
343 aField->myName = aFieldName.in();
344 aField->myEntity = aVEntity;
345 aField->myMeshName = aMeshName.in();
346 aField->myNbComp = myField->getNumberOfComponents();
347 aField->myDataSize = aMeshOnEntity->myNbCells * aField->myNbComp;
348 aField->myCompNames.resize(aField->myNbComp);
349 aField->myUnitNames.resize(aField->myNbComp);
351 if(MYDEBUG) MESSAGE("VISU_MEDFieldConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh->myDim);
353 TValField& aValField = aField->myValField;
354 int anId = myField->getIterationNumber();
355 PCValForTime aValForTime = aValField[anId](new TCValForTime());
356 aValForTime->myId = anId;
357 CORBA::Double aDT = myField->getTime();
358 aValForTime->myTime = TTime(aDT,"");
359 aValForTime->myField = myField;
362 MESSAGE("VISU_MEDFieldConvertor::Build - aFieldName = '"<<aFieldName<<
363 "'; myId = "<<anId<<"; myTime = "<<aDT);
370 VISU_MEDConvertor::Build()
372 if(mySObject->_is_nil())
373 throw std::runtime_error("VISU_MEDConvertor::Build >> mySObject->_is_nil() !!!");
374 SALOMEDS::Study_var aStudy = mySObject->GetStudy();
376 CORBA::Object_var aMedObject = VISU::SObjectToObject(mySObject);
377 if(!CORBA::is_nil(aMedObject)){
378 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(aMedObject);
382 SALOMEDS::ChildIterator_var aTimeStampIterator = aStudy->NewChildIterator(mySObject);
383 return Build(aTimeStampIterator);
388 using namespace boost;
390 struct TSObjectByName{
392 typedef tuple<SALOMEDS::SObject_var> TRet;
394 TSObjectByName(const std::string& theName):
398 TRet operator()(SALOMEDS::SObject_ptr theSObj, bool& theIsSuccess)
400 SALOMEDS::GenericAttribute_var anAttr;
401 if(theSObj->FindAttribute(anAttr,"AttributeName")){
402 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
403 CORBA::String_var aValue = aName->Value();
404 theIsSuccess = (myName == aValue.in());
406 return TRet(SALOMEDS::SObject::_duplicate(theSObj));
415 typedef tuple<SALOME_MED::MESH_var,SALOMEDS::SObject_var> TRet;
417 TMeshByName(const std::string& theName):
421 TRet operator()(SALOMEDS::SObject_ptr theSObj, bool& theIsSuccess)
423 CORBA::Object_var anObj = VISU::SObjectToObject(theSObj);
424 if(!CORBA::is_nil(anObj)){
425 SALOME_MED::MESH_var aMesh = SALOME_MED::MESH::_narrow(anObj);
426 if(!CORBA::is_nil(aMesh)){
427 CORBA::String_var aName = aMesh->getName();
428 theIsSuccess = (myName == aName.in());
430 return TRet(aMesh,SALOMEDS::SObject::_duplicate(theSObj));
437 template<typename TFun>
439 Find(SALOMEDS::SObject_ptr theStartSObj,
440 SALOMEDS::Study_ptr theStudy,
443 bool theIsAllLevels = true)
445 SALOMEDS::ChildIterator_var anIter = theStudy->NewChildIterator(theStartSObj);
446 anIter->InitEx(theIsAllLevels);
447 for(; anIter->More(); anIter->Next()){
448 SALOMEDS::SObject_var aSObj = anIter->Value();
449 typename TFun::TRet aRet = theFun(aSObj,theIsSuccess);
453 return typename TFun::TRet();
459 VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED)
461 if(CORBA::is_nil(theMED))
464 CORBA::Long aNbMeshes = theMED->getNumberOfMeshes();
465 SALOME_MED::string_array_var aMeshNames = theMED->getMeshNames();
466 if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aNbMeshes = "<<aNbMeshes);
468 SALOMEDS::Study_var aStudy = mySObject->GetStudy();
469 SALOMEDS::SObject_var aMedCompSObj = mySObject->GetFather();
471 bool anIsSuccess = false;
472 TSObjectByName::TRet aSObjectByNameRet =
473 Find(aMedCompSObj,aStudy,TSObjectByName("MEDMESH"),anIsSuccess);
475 SALOMEDS::SObject_var aMeshesSObj = boost::get<0>(aSObjectByNameRet);
476 for(int iMesh = 0; iMesh < aNbMeshes; iMesh++){
478 CORBA::String_var aMeshName = aMeshNames[iMesh];
479 TMeshByName::TRet aMeshByNameRet =
480 Find(aMeshesSObj,aStudy,TMeshByName(aMeshName.in()),anIsSuccess);
484 PCMesh aMesh = myMeshMap[aMeshName.in()](new TCMesh());
485 SALOME_MED::MESH_var aMEDMesh = boost::get<0>(aMeshByNameRet);
486 aMesh->myDim = aMEDMesh->getSpaceDimension();
487 aMesh->myName = aMeshName.in();
488 aMesh->myPointsDim.resize(aMesh->myDim);
489 aMesh->myMesh = aMEDMesh;
492 MESSAGE("VISU_MEDConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh->myDim);
495 std::ostringstream aStream;
496 aStream<<"MEDSUPPORTS_OF_"<<aMeshName.in();
497 std::string aSupportsName(aStream.str());
498 TSObjectByName::TRet aSObjectByNameRet =
499 Find(aMeshesSObj,aStudy,TSObjectByName(aSupportsName.c_str()),anIsSuccess);
503 TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
504 SALOMEDS::SObject_var aSupportsSObj = boost::get<0>(aSObjectByNameRet);
505 SALOMEDS::ChildIterator_var aSupportIterator = aStudy->NewChildIterator(aSupportsSObj);
507 // Fill all MeshOnEntity
508 aSupportIterator->InitEx(true);
509 for(; aSupportIterator->More(); aSupportIterator->Next()){
510 SALOMEDS::SObject_var aSupportSObj = aSupportIterator->Value();
512 CORBA::Object_var aMedSupport = VISU::SObjectToObject(aSupportSObj);
513 if(CORBA::is_nil(aMedSupport))
516 SALOME_MED::SUPPORT_var aMEDSupport = SALOME_MED::SUPPORT::_narrow(aMedSupport);
517 if(aMEDSupport->_is_nil())
520 SALOME_MED::MESH_var aMeshOnSupport = aMEDSupport->getMesh();
521 SALOME_MED::medEntityMesh aMEntity = aMEDSupport->getEntity();
522 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
523 CORBA::String_var aSupportName = aMEDSupport->getName();
525 if(aMEDSupport->isOnAllElements()){
526 if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - Support isOnAllElements = '"<<aSupportName<<"' aVEntity = "<<aVEntity);
527 int aNbCells, aCellsSize;
528 //Check, if there is any data on the support?
529 if(aVEntity == NODE_ENTITY){
530 aMesh->myNbPoints = aMeshOnSupport->getNumberOfNodes();
531 aNbCells = aMesh->myNbPoints;
532 aCellsSize = 2*aMesh->myNbPoints;
534 GetCellsSize(aNbCells,aCellsSize,aMeshOnSupport,aVEntity);
537 PCMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TCMeshOnEntity());
538 aMeshOnEntity->myMeshName = aMeshName.in();
539 aMeshOnEntity->myEntity = aVEntity;
540 aMeshOnEntity->myNbCells = aNbCells;
541 aMeshOnEntity->myCellsSize = aCellsSize;
542 aMeshOnEntity->mySupport = aMEDSupport;
548 aSupportIterator->InitEx(true);
549 for(; aSupportIterator->More(); aSupportIterator->Next()){
550 SALOMEDS::SObject_var aSupportSObj = aSupportIterator->Value();
552 CORBA::Object_var aMedSupport = VISU::SObjectToObject(aSupportSObj);
553 if(CORBA::is_nil(aMedSupport))
556 SALOME_MED::SUPPORT_var aMEDSupport = SALOME_MED::SUPPORT::_narrow(aMedSupport);
557 if(aMEDSupport->_is_nil())
560 SALOME_MED::MESH_var aMeshOnSupport = aMEDSupport->getMesh();
561 SALOME_MED::medEntityMesh aMEntity = aMEDSupport->getEntity();
562 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
563 CORBA::String_var aSupportName = aMEDSupport->getName();
565 SALOME_MED::FAMILY_var aMEDFamily = SALOME_MED::FAMILY::_narrow(aMedSupport);
566 if(!aMEDFamily->_is_nil()) {
567 int aNbCells, aCellsSize;
568 GetCellsSize(aNbCells,aCellsSize,aMEDFamily);
570 if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aFamily = '"<<aSupportName<<"' aVEntity = "<<aVEntity);
571 TMeshOnEntityMap::iterator aMeshOnEntityMapIter = aMeshOnEntityMap.find(aVEntity);
572 if(aMeshOnEntityMapIter == aMeshOnEntityMap.end())
575 PCMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
576 TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
577 PCFamily aFamily = aFamilyMap[aSupportName.in()](new TCFamily());
578 aFamily->myName = aSupportName.in();
579 aFamily->myEntity = aVEntity;
580 aFamily->myNbCells = aNbCells;
581 aFamily->myCellsSize = aCellsSize;
582 aFamily->myId = aMEDFamily->getIdentifier();
583 aFamily->myFamily = aMEDFamily;
589 aSupportIterator->InitEx(true);
590 for(; aSupportIterator->More(); aSupportIterator->Next()){
591 SALOMEDS::SObject_var aSupportSObj = aSupportIterator->Value();
593 CORBA::Object_var aMedSupport = VISU::SObjectToObject(aSupportSObj);
594 if(CORBA::is_nil(aMedSupport))
597 SALOME_MED::SUPPORT_var aMEDSupport = SALOME_MED::SUPPORT::_narrow(aMedSupport);
598 if(aMEDSupport->_is_nil())
601 SALOME_MED::MESH_var aMeshOnSupport = aMEDSupport->getMesh();
602 SALOME_MED::medEntityMesh aMEntity = aMEDSupport->getEntity();
603 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
604 CORBA::String_var aSupportName = aMEDSupport->getName();
606 SALOME_MED::GROUP_var aMEDGroup = SALOME_MED::GROUP::_narrow(aMedSupport);
607 if(!aMEDGroup->_is_nil()){
608 if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aGroup = '"<<aSupportName<<"' aVEntity = "<<aVEntity);
609 TGroupMap& aGroupMap = aMesh->myGroupMap;
610 PCGroup aGroup = aGroupMap[aSupportName.in()](new TCGroup());
611 aGroup->myGroup = aMEDGroup;
612 SALOME_MED::Family_array_var aFamilies = aMEDGroup->getFamilies();
613 int iFamilyEnd = aFamilies->length();
614 for(int iFamaily = 0; iFamaily < iFamilyEnd; iFamaily++){
615 SALOME_MED::FAMILY_var aMEDFamily = aFamilies[iFamaily];
616 CORBA::String_var aFamilyName = aMEDFamily->getName();
617 if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aGroup - aFamilyName = '"<<aFamilyName.in()<<"'");
618 PFamily aFamily = FindFamily(aMesh,aFamilyName.in());
620 VISU::TBindGroups& aBindGroups = aFamily->myGroups;
621 aBindGroups.insert(aSupportName.in());
630 aSObjectByNameRet = Find(aMedCompSObj,aStudy,TSObjectByName("MEDFIELD"),anIsSuccess);
632 SALOMEDS::SObject_var aFieldsSObj = boost::get<0>(aSObjectByNameRet);
633 if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - MEDFIELD found.");
634 SALOMEDS::ChildIterator_var aFieldIterator = aStudy->NewChildIterator(aFieldsSObj);
635 for(int iField = 0; aFieldIterator->More(); aFieldIterator->Next(), iField++){
636 SALOMEDS::SObject_var aFieldSObj = aFieldIterator->Value();
637 if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aFieldName = '"<<GetSObjectName(aFieldSObj)<<"'");
638 SALOMEDS::ChildIterator_var aTimeStampIterator = aStudy->NewChildIterator(aFieldSObj);
639 for(; aTimeStampIterator->More(); aTimeStampIterator->Next()){
640 SALOMEDS::SObject_var aTimeStampSObj = aTimeStampIterator->Value();
641 if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aTimeStampSObj = '"<<GetSObjectName(aTimeStampSObj)<<"'");
642 CORBA::Object_var aMedField = VISU::SObjectToObject(aTimeStampSObj);
643 if(CORBA::is_nil(aMedField))
646 SALOME_MED::FIELD_var aMEDField = SALOME_MED::FIELD::_narrow(aMedField);
647 if(aMEDField->_is_nil())
650 SALOME_MED::SUPPORT_var aMEDSupport = aMEDField->getSupport();
651 if(aMEDSupport->_is_nil())
654 SALOME_MED::medEntityMesh aMEntity = aMEDSupport->getEntity();
655 VISU::TEntity anEntity = MEDEntityToVTK(aMEntity);
656 SALOME_MED::MESH_var aMEDMesh = aMEDSupport->getMesh();
657 if(aMEDMesh->_is_nil())
660 CORBA::String_var aMeshName = aMEDMesh->getName();
661 CORBA::String_var aFieldName = aMEDField->getName();
663 TMeshMap::iterator aMeshMapIter = myMeshMap.find(aMeshName.in());
664 if(aMeshMapIter == myMeshMap.end())
667 PCMesh aMesh = aMeshMapIter->second;
668 TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
669 TMeshOnEntityMap::iterator aMeshOnEntityMapIter = aMeshOnEntityMap.find(anEntity);
670 if(aMeshOnEntityMapIter == aMeshOnEntityMap.end())
673 PCMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
674 TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
675 TFieldMap::iterator aFieldMapIter = aFieldMap.find(aFieldName.in());
677 if(aFieldMapIter == aFieldMap.end()){
678 aField = aFieldMap[aFieldName.in()](new TCField());
679 aField->myId = iField;
680 aField->myName = aFieldName.in();
681 aField->myEntity = anEntity;
682 aField->myMeshName = aMeshName.in();
683 aField->myNbComp = aMEDField->getNumberOfComponents();
684 aField->myDataSize = aMeshOnEntity->myNbCells * aField->myNbComp;
686 MESSAGE("VISU_MEDConvertor::Build - aMeshOnEntity->myNbCells = "<<aMeshOnEntity->myNbCells);
687 aField->myCompNames.resize(aField->myNbComp);
688 aField->myUnitNames.resize(aField->myNbComp);
690 aField = aFieldMapIter->second;
692 TValField& aValField = aField->myValField;
693 int anId = aMEDField->getIterationNumber();
694 PCValForTime aValForTime = aValField[anId](new TCValForTime());
695 aValForTime->myId = anId;
696 CORBA::Double aDT = aMEDField->getTime();
697 aValForTime->myTime = TTime(aDT,"");
698 aValForTime->myField = aMEDField;
700 MESSAGE("VISU_MEDConvertor::Build - aMeshName = '"<<aMeshName<<
701 "'; myEntity = "<<anEntity<<"; myTime = "<<aDT);
710 VISU_MEDConvertor::Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator)
712 if(theTimeStampIterator->_is_nil()) return NULL;
713 for(; theTimeStampIterator->More(); theTimeStampIterator->Next()){
714 SALOMEDS::SObject_var aTimeStampSObj = theTimeStampIterator->Value();
715 if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aTimeStampSObj = '"<<GetSObjectName(aTimeStampSObj)<<"'");
717 CORBA::Object_var aMedField = VISU::SObjectToObject(aTimeStampSObj);
718 if(CORBA::is_nil(aMedField))
721 SALOME_MED::FIELD_var aMEDField = SALOME_MED::FIELD::_narrow(aMedField);
722 if(aMEDField->_is_nil())
725 SALOME_MED::SUPPORT_var aMEDSupport = aMEDField->getSupport();
726 if(aMEDSupport->_is_nil())
729 SALOME_MED::medEntityMesh aMEntity = aMEDSupport->getEntity();
730 TEntity aVEntity = MEDEntityToVTK(aMEntity);
731 SALOME_MED::MESH_var aMEDMesh = aMEDSupport->getMesh();
732 if(aMEDMesh->_is_nil()) continue;
733 CORBA::String_var aMeshName = aMEDMesh->getName();
734 CORBA::String_var aFieldName = aMEDField->getName();
736 PCMesh aMesh = myMeshMap[aMeshName.in()](new TCMesh());
737 aMesh->myDim = aMEDMesh->getSpaceDimension();
738 aMesh->myPointsDim.resize(aMesh->myDim);
739 aMesh->myName = aMeshName.in();
740 aMesh->myNbPoints = aMEDMesh->getNumberOfNodes();
741 aMesh->myMesh = aMEDMesh;
742 if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh->myDim);
744 TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
745 PCMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TCMeshOnEntity());
746 aMeshOnEntity->myEntity = aVEntity;
747 aMeshOnEntity->myMeshName = aMeshName.in();
748 aMeshOnEntity->mySupport = aMEDSupport;
750 if(aVEntity == NODE_ENTITY){
751 PCMeshOnEntity aMeshOnEntity2 = aMeshOnEntityMap[CELL_ENTITY](new TCMeshOnEntity());
752 *aMeshOnEntity2 = *aMeshOnEntity;
753 aMeshOnEntity->myEntity = CELL_ENTITY;
754 GetCellsSize(aMesh,aMEDMesh,CELL_ENTITY);
756 PCMeshOnEntity aMeshOnEntity2 = aMeshOnEntityMap[NODE_ENTITY](new TCMeshOnEntity());
757 *aMeshOnEntity2 = *aMeshOnEntity;
758 aMeshOnEntity->myEntity = NODE_ENTITY;
759 GetCellsSize(aMesh,aMEDMesh,NODE_ENTITY);
761 GetCellsSize(aMesh,aMEDMesh,aVEntity);
763 TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
764 TFieldMap::iterator aFieldMapIter = aFieldMap.find(aFieldName.in());
766 if(aFieldMapIter == aFieldMap.end()){
767 aField = aFieldMap[aFieldName.in()](new TCField());
768 CORBA::Short iField = mySObject->Tag();
769 aField->myId = iField;
770 aField->myName = aFieldName.in();
771 aField->myEntity = aVEntity;
772 aField->myMeshName = aMeshName.in();
773 aField->myNbComp = aMEDField->getNumberOfComponents();
774 aField->myDataSize = aMeshOnEntity->myNbCells * aField->myNbComp;
776 MESSAGE("VISU_MEDConvertor::Build - aMeshOnEntity->myNbCells = "<<aMeshOnEntity->myNbCells);
777 aField->myCompNames.resize(aField->myNbComp);
778 aField->myUnitNames.resize(aField->myNbComp);
781 TValField& aValField = aField->myValField;
782 int anId = aMEDField->getIterationNumber();
783 PCValForTime aValForTime = aValField[anId](new TCValForTime());
784 aValForTime->myId = anId;
785 CORBA::Double aDT = aMEDField->getTime();
786 aValForTime->myTime = TTime(aDT,"");
787 aValForTime->myField = aMEDField;
789 MESSAGE("VISU_MEDConvertor::Build - aMeshName = '"<<aMeshName<<
790 "'; myEntity = "<<aVEntity<<"; myTime = "<<aDT);
797 VISU_MEDConvertor::LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity,
798 const string& theFamilyName)
801 const string& aMeshName = theMeshOnEntity->myMeshName;
802 const TEntity& aVEntity = theMeshOnEntity->myEntity;
803 PCMesh aMesh = myMeshMap[aMeshName];
805 if(aVEntity == NODE_ENTITY)
806 isPointsUpdated = LoadPoints(aMesh,theFamilyName);
808 isPointsUpdated = LoadPoints(aMesh);
809 int isCellsOnEntityUpdated = LoadCellsOnEntity(aMesh,theMeshOnEntity,theFamilyName);
811 return (isPointsUpdated || isCellsOnEntityUpdated);
816 VISU_MEDConvertor::LoadMeshOnGroup(VISU::PMeshImpl theMesh,
817 const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
820 int isPointsUpdated = 0;
821 int isCellsOnEntityUpdated = 0;
822 VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin();
823 for(; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
824 const string& aFamilyName = aFamilyAndEntitySetIter->first;
825 const VISU::TEntity& aVEntity = aFamilyAndEntitySetIter->second;
826 PCMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
827 if(aVEntity == VISU::NODE_ENTITY){
828 isPointsUpdated += LoadPoints(theMesh,aFamilyName);
829 isCellsOnEntityUpdated += LoadCellsOnEntity(theMesh,aMeshOnEntity);
831 isPointsUpdated += LoadPoints(theMesh);
832 isCellsOnEntityUpdated += LoadCellsOnEntity(theMesh,aMeshOnEntity,aFamilyName);
836 return (isPointsUpdated || isCellsOnEntityUpdated);
841 VISU_MEDConvertor::LoadFieldOnMesh(VISU::PMeshImpl theMesh,
842 VISU::PMeshOnEntityImpl theMeshOnEntity,
843 VISU::PFieldImpl theField,
844 VISU::PValForTimeImpl theValForTime)
847 int isPointsUpdated = LoadPoints(theMesh);
848 int isCellsOnEntityUpdated = LoadCellsOnEntity(theMesh,theMeshOnEntity);
849 int isFieldUpdated = LoadField(theMesh,theMeshOnEntity,theField,theValForTime);
851 return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
855 VISU_MEDConvertor::LoadPoints(VISU::PCMesh theMesh,
856 const string& theFamilyName)
858 //Check on existing family
859 PCMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
860 PCFamily aFamily = GetFamily(aMeshOnEntity,theFamilyName);
861 //Check on loading already done
862 bool isPointsLoaded = !theMesh->myPointsCoord.empty();
866 else if(!aFamily->mySubMesh.empty())
870 MESSAGE("LoadPoints - isPointsLoaded = "<<isPointsLoaded<<"; theFamilyName = '"<<theFamilyName<<"'");
872 SALOME_MED::MESH_var& aMedMesh = theMesh->myMesh;
873 int iNumElemEnd = aMedMesh->getNumberOfNodes();
874 TMeshImpl::TPointsCoord& aPointsCoord = theMesh->myPointsCoord;
875 if(MYDEBUG) MESSAGE("LoadPoints - iNumElemEnd = "<<iNumElemEnd);
876 if (iNumElemEnd <= 0) throw std::runtime_error("LoadPoints >> There is no points in the mesh !!!");
877 aPointsCoord.resize(theMesh->myDim*iNumElemEnd,0.0);
878 SALOME_MED::double_array_var coord = aMedMesh->getCoordinates(SALOME_MED::MED_FULL_INTERLACE);
880 for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
881 for(int iDim = 0, iNumElem2Dim = iNumElem*theMesh->myDim; iDim < theMesh->myDim; iDim++, iNumElem2Dim++)
882 aPointsCoord[iNumElem2Dim] = coord[iNumElem2Dim];
883 if(MYDEBUG) MESSAGE("LoadPoints - Filling aMeshOnEntity with type NODE_ENTITY");
884 TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aMeshOnEntity->myCellsConn[VTK_VERTEX];
885 aConnForCellType.resize(iNumElemEnd);
886 for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
887 aConnForCellType[iNumElem] = TMeshOnEntityImpl::TConnect(1,iNumElem);
890 if(MYDEBUG) MESSAGE("LoadPoints - Filling aFamily SubMesh");
891 SALOME_MED::FAMILY_var aMedFamily = aFamily->myFamily;
892 TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[VTK_VERTEX];
893 SALOME_MED::medGeometryElement_array_var aGeom = aMedFamily->getTypes();
894 SALOME_MED::long_array_var aCellNumForType = aMedFamily->getNumber(aGeom[0]);
895 int iNumElemEndTmp = iNumElemEnd;
896 iNumElemEnd = aCellNumForType->length();
897 for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
898 int tmp = aCellNumForType[iNumElem]-1;
899 if(0 > tmp || tmp >= iNumElemEndTmp) {
900 static QString aString;
901 aString.sprintf("LoadPoints >> iNumElemEndTmp(%d) <= aCellNumForType[%d]=%d < 0 !!!",iNumElemEnd,iNumElem,tmp);
902 throw std::runtime_error(aString.latin1());
904 aSubMeshOnCellType.insert(tmp);
912 VISU_MEDConvertor::LoadCellsOnEntity(VISU::PCMesh theMesh,
913 VISU::PCMeshOnEntity theMeshOnEntity,
914 const string& theFamilyName)
916 //Check on existing family
917 PCFamily aFamily = GetFamily(theMeshOnEntity,theFamilyName);
918 //Check on loading already done
919 bool isCellsLoaded = !theMeshOnEntity->myCellsConn.empty();
923 else if(!aFamily->mySubMesh.empty())
926 SALOME_MED::SUPPORT_var& aMedSupport = theMeshOnEntity->mySupport;
927 SALOME_MED::MESH_var aMedMesh = aMedSupport->getMesh();
929 MESSAGE("LoadCellsOnEntity - theFamilyName = '"<<theFamilyName<<"'");
930 MESSAGE("LoadCellsOnEntity - isCellsLoaded = "<<isCellsLoaded<<"; isFamilyPresent = "<<bool(aFamily));
934 SALOME_MED::medGeometryElement* aGeomElems;
935 const TEntity& aVEntity = theMeshOnEntity->myEntity;
936 int iGeomEnd = GetEntity2Geom(aVEntity,aGeomElems);
937 const SALOME_MED::medEntityMesh& aMEntity = VTKEntityToMED(aVEntity);
938 int aNbPoints = theMesh->myPointsCoord.size()/theMesh->myDim;
940 for(int iGeom = 0, aCounter = 0; iGeom < iGeomEnd; iGeom++){
941 SALOME_MED::medGeometryElement aGeom = aGeomElems[iGeom];
942 int aMNbNodes = MEDGeom2NbNodes(aGeom);
943 int aVGeom = MEDGeomToVTK(aGeom);
944 int aVNbNodes = VTKGeom2NbNodes(aVGeom);
945 int iNumElemEnd = aMedMesh->getNumberOfElements(aMEntity,aGeom);
946 if (iNumElemEnd > 0) {
947 SALOME_MED::long_array_var conn =
948 aMedMesh->getConnectivity(SALOME_MED::MED_FULL_INTERLACE,SALOME_MED::MED_NODAL,aMEntity,aGeom);
949 TMeshOnEntityImpl::TConnForCellType& aConnForCellType = theMeshOnEntity->myCellsConn[aVGeom];
950 //APO - aConnForCellType.resize(iNumElemEnd);
951 vector<int> aConnect(aMNbNodes);
952 int aNbConnForElem = conn->length()/iNumElemEnd;
953 if(MYDEBUG) MESSAGE("LoadCellsOnEntity - aGeom = "<<aGeom<<
954 "; iNumElemEnd = "<<iNumElemEnd<<
955 "; aNbConnForElem = "<<aNbConnForElem);
956 for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
957 VISU::TMeshOnEntityImpl::TConnect anArray(aVNbNodes);
958 for (int k = 0, kj = iNumElem*aNbConnForElem; k < aMNbNodes; k++) {
959 aConnect[k] = conn[kj+k] - 1;
962 case SALOME_MED::MED_TETRA4 :
963 case SALOME_MED::MED_TETRA10 :
964 anArray[0] = aConnect[0];
965 anArray[1] = aConnect[1];
966 anArray[2] = aConnect[3];
967 anArray[3] = aConnect[2];
969 case SALOME_MED::MED_PYRA5 :
970 case SALOME_MED::MED_PYRA13 :
971 anArray[0] = aConnect[0];
972 anArray[1] = aConnect[3];
973 anArray[2] = aConnect[2];
974 anArray[3] = aConnect[1];
975 anArray[4] = aConnect[4];
978 for (int k = 0; k < aVNbNodes; k++)
979 anArray[k] = aConnect[k];
981 for (int k = 0; k < aVNbNodes; k++)
982 if(anArray[k] < 0 || aNbPoints <= anArray[k]){
983 static QString aString;
984 aString.sprintf("ImportCells >> aNbPoints(%d) <= anArray[%d][%d]=%d < 0 !!!",aNbPoints,iNumElem,k,anArray[k]);
985 throw std::runtime_error(aString.latin1());
987 aConnForCellType.push_back(anArray);
989 //Workaround for MED Component data structure
990 int aSize = aConnForCellType.size();
991 theMeshOnEntity->myCellsFirstIndex[aGeom] = TCMeshOnEntity::TIndexAndSize(aCounter,aSize);
996 //Filling aFamily SubMesh
998 SALOME_MED::FAMILY_var aMedFamily = aFamily->myFamily;
999 SALOME_MED::medGeometryElement_array_var aGeoms = aMedFamily->getTypes();
1000 iGeomEnd = aGeoms->length();
1001 if(MYDEBUG) MESSAGE("LoadCellsOnEntity - iGeomEnd = "<<iGeomEnd);
1002 for (int iGeom = 0; iGeom < iGeomEnd; iGeom++) {
1003 SALOME_MED::medGeometryElement aGeom = aGeoms[iGeom];
1004 SALOME_MED::long_array_var aCellNumForType = aMedFamily->getNumber(aGeom);
1005 int aVGeom = MEDGeomToVTK(aGeom);
1006 TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVGeom];
1007 int iNumElemEndTmp = theMeshOnEntity->myCellsConn[aVGeom].size();
1008 int iNumElemEnd = aCellNumForType->length();
1009 int aCounter = theMeshOnEntity->myCellsFirstIndex[aGeom].first;
1011 MESSAGE("LoadCellsOnEntity - aGeom = "<<aGeom<<
1012 "; iNumElemEnd = "<<iNumElemEnd<<
1013 "; aCounter = "<<aCounter);
1014 for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
1015 int tmp = aCellNumForType[iNumElem]-aCounter-1;
1016 if(0 > tmp || tmp >= iNumElemEndTmp) {
1017 static QString aString;
1018 aString.sprintf("LoadCellsOnEntity >> iNumElemEndTmp(%d) <= aCellNumForType[%d]=%d < 0 !!!",iNumElemEndTmp,iNumElem,tmp);
1019 throw std::runtime_error(aString.latin1());
1021 aSubMeshOnCellType.insert(tmp);
1028 template<class TArray>
1030 ImportField(TArray& theArray,
1031 VISU::PCMesh theMesh,
1032 VISU::PCField theField,
1033 VISU::PCValForTime theValForTime,
1034 VISU::PCMeshOnEntity theMeshOnEntity)
1036 if(theField->myEntity == NODE_ENTITY){
1037 TValForTimeImpl::TValForCellsWithType& aValForCellsWithType =
1038 theValForTime->myValForCells[VTK_VERTEX];
1039 int iNumElemEnd = theMesh->myPointsCoord.size()/theMesh->myDim*theField->myNbComp;
1040 if(MYDEBUG) MESSAGE("ImportField - iNumElemEnd = "<<iNumElemEnd);
1041 aValForCellsWithType.resize(iNumElemEnd);
1042 for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
1043 aValForCellsWithType[iNumElem] = theArray[iNumElem];
1045 SALOME_MED::medGeometryElement* aGeomElems;
1046 const TEntity& aVEntity = theField->myEntity;
1047 int iGeomEnd = GetEntity2Geom(aVEntity,aGeomElems);
1048 for(int iGeom = 0; iGeom < iGeomEnd; iGeom++){
1049 SALOME_MED::medGeometryElement aGeom = aGeomElems[iGeom];
1050 int aVGeom = MEDGeomToVTK(aGeom);
1051 const TCMeshOnEntity::TCellsFirstIndex& aCellsFirstIndex = theMeshOnEntity->myCellsFirstIndex;
1052 TCMeshOnEntity::TCellsFirstIndex::const_iterator aCellsFirstIndexIter = aCellsFirstIndex.find(aGeom);
1053 if(aCellsFirstIndexIter != aCellsFirstIndex.end()){
1054 const TCMeshOnEntity::TIndexAndSize& aIndexAndSize = aCellsFirstIndexIter->second;
1055 int iNumElemEnd = aIndexAndSize.second;
1057 MESSAGE("ImportField - aGeom = "<<aGeom<<
1058 "; aIndexAndSize = {"<<aIndexAndSize.first<<
1059 ","<<aIndexAndSize.second<<"}");
1060 TValForTimeImpl::TValForCellsWithType& aValForCellsWithType = theValForTime->myValForCells[aVGeom];
1061 aValForCellsWithType.resize(iNumElemEnd*theField->myNbComp);
1062 for(int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
1063 for(int k = 0, kj = iNumElem*theField->myNbComp; k < theField->myNbComp; k++)
1064 aValForCellsWithType[kj+k] = theArray[aIndexAndSize.first*theField->myNbComp+kj+k];
1072 VISU_MEDConvertor::LoadField(VISU::PCMesh theMesh,
1073 VISU::PCMeshOnEntity theMeshOnEntity,
1074 VISU::PField theField,
1075 VISU::PCValForTime theValForTime)
1077 //Check on loading already done
1078 if(!theValForTime->myValForCells.empty())
1081 SALOME_MED::FIELD_var aMEDField = theValForTime->myField;
1082 SALOME_MED::FIELDDOUBLE_ptr aFieldDouble = SALOME_MED::FIELDDOUBLE::_narrow(aMEDField);
1083 if(!aFieldDouble->_is_nil()){
1084 SALOME_MED::double_array_var anArray = aFieldDouble->getValue(SALOME_MED::MED_FULL_INTERLACE);
1085 if(MYDEBUG) MESSAGE("VISU_MEDConvertor::LoadField - There is FIELDDOUBLE = "<<anArray->length());
1086 ::ImportField(anArray,theMesh,theField,theValForTime,theMeshOnEntity);
1088 SALOME_MED::FIELDINT_ptr aFieldInt = SALOME_MED::FIELDINT::_narrow(aMEDField);
1089 if(!aFieldInt->_is_nil()){
1090 SALOME_MED::long_array_var anArray = aFieldInt->getValue(SALOME_MED::MED_FULL_INTERLACE);
1091 if(MYDEBUG) MESSAGE("VISU_MEDConvertor::LoadField - There is FIELDINT = "<<anArray->length());
1092 ::ImportField(anArray,theMesh,theField,theValForTime,theMeshOnEntity);