#define USER_INTERLACE MED_FULL_INTERLACE
#ifdef _DEBUG_
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
#else
static int MYDEBUG = 0;
#endif
extern "C" {
- VISU_Convertor* CreateMEDConvertor(SALOMEDS::SObject_ptr theMedSObject) {
+ VISU_Convertor*
+ CreateMEDConvertor(SALOMEDS::SObject_ptr theMedSObject)
+ {
return new VISU_MEDConvertor(theMedSObject);
}
- VISU_Convertor* CreateMEDFieldConvertor(SALOME_MED::FIELD_ptr theField) {
+
+ VISU_Convertor*
+ CreateMEDFieldConvertor(SALOME_MED::FIELD_ptr theField)
+ {
return new VISU_MEDFieldConvertor(theField);
}
}
vtkIdType aNbCells, aCellsSize;
GetCellsSize(aNbCells,aCellsSize,theMEDMesh,CELL_ENTITY);
if(aNbCells > 0){
- PCMeshOnEntity aMeshOnCells = aMeshOnEntityMap[CELL_ENTITY];
- aMeshOnCells->myEntity = VISU::CELL_ENTITY;
- aMeshOnCells->myMeshName = theMesh->myName;
- aMeshOnCells->myNbCells = aNbCells;
- aMeshOnCells->myCellsSize = aCellsSize;
+
+ TMeshOnEntityMap::iterator aIter = aMeshOnEntityMap.find(CELL_ENTITY);
+ if (aIter != aMeshOnEntityMap.end()){
+ VISU::PCMeshOnEntity aMeshOnCells = aIter->second;
+
+ aMeshOnCells->myEntity = VISU::CELL_ENTITY;
+ aMeshOnCells->myMeshName = theMesh->myName;
+ aMeshOnCells->myNbCells = aNbCells;
+ aMeshOnCells->myCellsSize = aCellsSize;
+ }
}
- }else
+ }else{
GetCellsSize(aMeshOnEntity->myNbCells,aMeshOnEntity->myCellsSize,theMEDMesh,theEntity);
+ }
}
}
bool anIsSuccess = false;
TSObjectByName::TRet aSObjectByNameRet =
Find(aMedCompSObj,aStudy,TSObjectByName("MEDMESH"),anIsSuccess);
+ if(MYDEBUG)
+ MESSAGE("VISU_MEDConvertor::Build - Find ('"<<"MEDMESH"<<"') = "<<anIsSuccess);
if(anIsSuccess){
SALOMEDS::SObject_var aMeshesSObj = boost::get<0>(aSObjectByNameRet);
for(int iMesh = 0; iMesh < aNbMeshes; iMesh++){
CORBA::String_var aMeshName = aMeshNames[iMesh];
TMeshByName::TRet aMeshByNameRet =
Find(aMeshesSObj,aStudy,TMeshByName(aMeshName.in()),anIsSuccess);
+ if(MYDEBUG)
+ MESSAGE("VISU_MEDConvertor::Build - Find aMeshName('"<<aMeshName.in()<<"') = "<<anIsSuccess);
if(!anIsSuccess)
continue;
if(MYDEBUG)
MESSAGE("VISU_MEDConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh->myDim);
+ std::string aName = aMeshName.in();
+ std::replace(aName.begin(),aName.end(),' ','_');
+
anIsSuccess = false;
std::ostringstream aStream;
- aStream<<"MEDSUPPORTS_OF_"<<aMeshName.in();
+ aStream<<"MEDSUPPORTS_OF_"<<aName;
std::string aSupportsName(aStream.str());
TSObjectByName::TRet aSObjectByNameRet =
Find(aMeshesSObj,aStudy,TSObjectByName(aSupportsName.c_str()),anIsSuccess);
+ if(MYDEBUG)
+ MESSAGE("VISU_MEDConvertor::Build - Find aSupportsName('"<<aSupportsName<<"') = "<<anIsSuccess);
if(!anIsSuccess)
continue;
VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
CORBA::String_var aSupportName = aMEDSupport->getName();
- if(aMEDSupport->isOnAllElements()){
- if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - Support isOnAllElements = '"<<aSupportName<<"' aVEntity = "<<aVEntity);
+ if(aMEDSupport->isOnAllElements() && strcmp(aSupportName.in(),"SupportOnAll_MED_") > 0){
+ if(MYDEBUG)
+ MESSAGE("VISU_MEDConvertor::Build - Support isOnAllElements = '"<<aSupportName<<
+ "' aVEntity = "<<aVEntity);
int aNbCells, aCellsSize;
//Check, if there is any data on the support?
if(aVEntity == NODE_ENTITY){
SALOME_MED::FAMILY_var aMEDFamily = SALOME_MED::FAMILY::_narrow(aMedSupport);
if(!aMEDFamily->_is_nil()) {
- int aNbCells, aCellsSize;
- GetCellsSize(aNbCells,aCellsSize,aMEDFamily);
- if(aNbCells > 0){
- if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aFamily = '"<<aSupportName<<"' aVEntity = "<<aVEntity);
- TMeshOnEntityMap::iterator aMeshOnEntityMapIter = aMeshOnEntityMap.find(aVEntity);
- if(aMeshOnEntityMapIter == aMeshOnEntityMap.end())
- continue;
+ TMeshOnEntityMap::iterator aMeshOnEntityMapIter = aMeshOnEntityMap.find(aVEntity);
+ if(aMeshOnEntityMapIter == aMeshOnEntityMap.end())
+ continue;
+ PCMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
+
+ int aNbCells = aMeshOnEntity->myNbCells, aCellsSize = aMeshOnEntity->myCellsSize;
+ CORBA::Boolean anIsOnAllElements = aMEDSupport->isOnAllElements();
+ if(!anIsOnAllElements)
+ GetCellsSize(aNbCells,aCellsSize,aMEDFamily);
+
+ if(MYDEBUG)
+ MESSAGE("VISU_MEDConvertor::Build - aFamily = '"<<aSupportName<<
+ "'; anIsOnAllElements = "<<anIsOnAllElements<<
+ "; aVEntity = "<<aVEntity<<
+ "; aNbCells = "<<aNbCells);
- PCMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
+ if(aNbCells > 0){
TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
PCFamily aFamily = aFamilyMap[aSupportName.in()](new TCFamily());
aFamily->myName = aSupportName.in();
SALOME_MED::GROUP_var aMEDGroup = SALOME_MED::GROUP::_narrow(aMedSupport);
if(!aMEDGroup->_is_nil()){
- if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aGroup = '"<<aSupportName<<"' aVEntity = "<<aVEntity);
- TGroupMap& aGroupMap = aMesh->myGroupMap;
- PCGroup aGroup = aGroupMap[aSupportName.in()](new TCGroup());
+ CORBA::Boolean anIsOnAllElements = aMEDSupport->isOnAllElements();
+
+ if(MYDEBUG)
+ MESSAGE("VISU_MEDConvertor::Build - aGroup = '"<<aSupportName<<
+ "'; anIsOnAllElements = "<<anIsOnAllElements<<
+ "; aVEntity = "<<aVEntity);
+
+ PCGroup aGroup(new TCGroup());
aGroup->myGroup = aMEDGroup;
+ aGroup->myName = aSupportName.in();
+ aGroup->myMeshName = aMeshName.in();
+ VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup->myFamilyAndEntitySet;
+
SALOME_MED::Family_array_var aFamilies = aMEDGroup->getFamilies();
int iFamilyEnd = aFamilies->length();
for(int iFamaily = 0; iFamaily < iFamilyEnd; iFamaily++){
SALOME_MED::FAMILY_var aMEDFamily = aFamilies[iFamaily];
CORBA::String_var aFamilyName = aMEDFamily->getName();
- if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aGroup - aFamilyName = '"<<aFamilyName.in()<<"'");
PFamily aFamily = FindFamily(aMesh,aFamilyName.in());
+ if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aGroup - aFamilyName = '"<<aFamilyName.in()<<"' = "<<bool(aFamily));
if(aFamily){
+ TFamilyAndEntity aFamilyAndEntity(aFamilyName.in(),aFamily->myEntity);
+ aFamilyAndEntitySet.insert(aFamilyAndEntity);
+
+ aGroup->myNbCells += aFamily->myNbCells;
+ aGroup->myCellsSize += aFamily->myCellsSize;
+
VISU::TBindGroups& aBindGroups = aFamily->myGroups;
aBindGroups.insert(aSupportName.in());
}
}
+
+ if(!aGroup->myFamilyAndEntitySet.empty()){
+ TGroupMap& aGroupMap = aMesh->myGroupMap;
+ aGroupMap[aSupportName.in()] = aGroup;
+ }
+
}
}
}
aMesh->myName = aMeshName.in();
aMesh->myNbPoints = aMEDMesh->getNumberOfNodes();
aMesh->myMesh = aMEDMesh;
- if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh->myDim);
+ if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aMeshName = '"<<aMeshName<<"'; myDim = "<<aMesh->myDim);
TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
PCMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TCMeshOnEntity());
aMeshOnEntity->myEntity = aVEntity;
aMeshOnEntity->myMeshName = aMeshName.in();
aMeshOnEntity->mySupport = aMEDSupport;
-
if(aVEntity == NODE_ENTITY){
PCMeshOnEntity aMeshOnEntity2 = aMeshOnEntityMap[CELL_ENTITY](new TCMeshOnEntity());
*aMeshOnEntity2 = *aMeshOnEntity;
GetCellsSize(aMesh,aMEDMesh,NODE_ENTITY);
}
GetCellsSize(aMesh,aMEDMesh,aVEntity);
-
TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
TFieldMap::iterator aFieldMapIter = aFieldMap.find(aFieldName.in());
PCField aField;
aField->myCompNames.resize(aField->myNbComp);
aField->myUnitNames.resize(aField->myNbComp);
}
-
TValField& aValField = aField->myValField;
int anId = aMEDField->getIterationNumber();
PCValForTime aValForTime = aValField[anId](new TCValForTime());
SALOME_MED::MESH_var& aMedMesh = theMesh->myMesh;
int iNumElemEnd = aMedMesh->getNumberOfNodes();
TMeshImpl::TPointsCoord& aPointsCoord = theMesh->myPointsCoord;
+
if(MYDEBUG) MESSAGE("LoadPoints - iNumElemEnd = "<<iNumElemEnd);
- if (iNumElemEnd <= 0) throw std::runtime_error("LoadPoints >> There is no points in the mesh !!!");
+
+ if (iNumElemEnd <= 0)
+ throw std::runtime_error("LoadPoints >> There is no points in the mesh !!!");
+
aPointsCoord.resize(theMesh->myDim*iNumElemEnd,0.0);
SALOME_MED::double_array_var coord = aMedMesh->getCoordinates(SALOME_MED::MED_FULL_INTERLACE);
if(!isPointsLoaded){
for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
for(int iDim = 0, iNumElem2Dim = iNumElem*theMesh->myDim; iDim < theMesh->myDim; iDim++, iNumElem2Dim++)
aPointsCoord[iNumElem2Dim] = coord[iNumElem2Dim];
+
if(MYDEBUG) MESSAGE("LoadPoints - Filling aMeshOnEntity with type NODE_ENTITY");
+
TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aMeshOnEntity->myCellsConn[VTK_VERTEX];
aConnForCellType.resize(iNumElemEnd);
for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
}
if(aFamily){
if(MYDEBUG) MESSAGE("LoadPoints - Filling aFamily SubMesh");
+
SALOME_MED::FAMILY_var aMedFamily = aFamily->myFamily;
+ CORBA::Boolean anIsOnAllElements = aMedFamily->isOnAllElements();
TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[VTK_VERTEX];
- SALOME_MED::medGeometryElement_array_var aGeom = aMedFamily->getTypes();
- SALOME_MED::long_array_var aCellNumForType = aMedFamily->getNumber(aGeom[0]);
- int iNumElemEndTmp = iNumElemEnd;
- iNumElemEnd = aCellNumForType->length();
- for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
- int tmp = aCellNumForType[iNumElem]-1;
- if(0 > tmp || tmp >= iNumElemEndTmp) {
- static QString aString;
- aString.sprintf("LoadPoints >> iNumElemEndTmp(%d) <= aCellNumForType[%d]=%d < 0 !!!",iNumElemEnd,iNumElem,tmp);
- throw std::runtime_error(aString.latin1());
+
+ if(!anIsOnAllElements){
+ SALOME_MED::medGeometryElement_array_var aGeom = aMedFamily->getTypes();
+ SALOME_MED::long_array_var aCellNumForType = aMedFamily->getNumber(aGeom[0]);
+ int iNumElemEndTmp = iNumElemEnd;
+ iNumElemEnd = aCellNumForType->length();
+ for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
+ int tmp = aCellNumForType[iNumElem]-1;
+ if(0 > tmp || tmp >= iNumElemEndTmp) {
+ static QString aString;
+ aString.sprintf("LoadPoints >> iNumElemEndTmp(%d) <= aCellNumForType[%d]=%d < 0 !!!",iNumElemEnd,iNumElem,tmp);
+ throw std::runtime_error(aString.latin1());
+ }
+ aSubMeshOnCellType.insert(tmp);
+ }
+ }else{
+ for(int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++){
+ aSubMeshOnCellType.insert(iNumElem);
}
- aSubMeshOnCellType.insert(tmp);
}
}
return 1;
//Filling aFamily SubMesh
if(aFamily){
SALOME_MED::FAMILY_var aMedFamily = aFamily->myFamily;
- SALOME_MED::medGeometryElement_array_var aGeoms = aMedFamily->getTypes();
- iGeomEnd = aGeoms->length();
- if(MYDEBUG) MESSAGE("LoadCellsOnEntity - iGeomEnd = "<<iGeomEnd);
- for (int iGeom = 0; iGeom < iGeomEnd; iGeom++) {
- SALOME_MED::medGeometryElement aGeom = aGeoms[iGeom];
- SALOME_MED::long_array_var aCellNumForType = aMedFamily->getNumber(aGeom);
- int aVGeom = MEDGeomToVTK(aGeom);
- TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVGeom];
- int iNumElemEndTmp = theMeshOnEntity->myCellsConn[aVGeom].size();
- int iNumElemEnd = aCellNumForType->length();
- int aCounter = theMeshOnEntity->myCellsFirstIndex[aGeom].first;
- if(MYDEBUG)
- MESSAGE("LoadCellsOnEntity - aGeom = "<<aGeom<<
- "; iNumElemEnd = "<<iNumElemEnd<<
- "; aCounter = "<<aCounter);
- for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
- int tmp = aCellNumForType[iNumElem]-aCounter-1;
- if(0 > tmp || tmp >= iNumElemEndTmp) {
- static QString aString;
- aString.sprintf("LoadCellsOnEntity >> iNumElemEndTmp(%d) <= aCellNumForType[%d]=%d < 0 !!!",iNumElemEndTmp,iNumElem,tmp);
- throw std::runtime_error(aString.latin1());
+ CORBA::Boolean anIsOnAllElements = aMedFamily->isOnAllElements();
+ if(!anIsOnAllElements){
+ SALOME_MED::medGeometryElement_array_var aGeoms = aMedFamily->getTypes();
+ iGeomEnd = aGeoms->length();
+ if(MYDEBUG) MESSAGE("LoadCellsOnEntity - iGeomEnd = "<<iGeomEnd);
+ for (int iGeom = 0; iGeom < iGeomEnd; iGeom++) {
+ SALOME_MED::medGeometryElement aGeom = aGeoms[iGeom];
+ SALOME_MED::long_array_var aCellNumForType = aMedFamily->getNumber(aGeom);
+ int aVGeom = MEDGeomToVTK(aGeom);
+ TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVGeom];
+ int iNumElemEndTmp = theMeshOnEntity->myCellsConn[aVGeom].size();
+ int iNumElemEnd = aCellNumForType->length();
+ int aCounter = theMeshOnEntity->myCellsFirstIndex[aGeom].first;
+ if(MYDEBUG)
+ MESSAGE("LoadCellsOnEntity - aGeom = "<<aGeom<<
+ "; iNumElemEnd = "<<iNumElemEnd<<
+ "; aCounter = "<<aCounter);
+ for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
+ int tmp = aCellNumForType[iNumElem]-aCounter-1;
+ if(0 > tmp || tmp >= iNumElemEndTmp) {
+ static QString aString;
+ aString.sprintf("LoadCellsOnEntity >> iNumElemEndTmp(%d) <= aCellNumForType[%d]=%d < 0 !!!",iNumElemEndTmp,iNumElem,tmp);
+ throw std::runtime_error(aString.latin1());
+ }
+ aSubMeshOnCellType.insert(tmp);
}
- aSubMeshOnCellType.insert(tmp);
+ }
+ }else{
+ const TMeshOnEntityImpl::TCellsConn& aCellsConn = theMeshOnEntity->myCellsConn;
+ TMeshOnEntityImpl::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
+ for(; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
+ int aVGeom = aCellsConnIter->first;
+ const TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aCellsConnIter->second;
+ TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVGeom];
+ int iNumElemEnd = aConnForCellType.size();
+ for(int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
+ aSubMeshOnCellType.insert(iNumElem);
}
}
}