return VISU::eNONE;
}
+ //---------------------------------------------------------------
+ medGeometryElement
+ VISUGeomToMED(int theGeom)
+ {
+ switch(theGeom){
+ case VISU::ePOINT1: return MED_POINT1;
+ case VISU::eSEG2: return MED_SEG2;
+ case VISU::eTRIA3: return MED_TRIA3;
+ case VISU::eQUAD4: return MED_QUAD4;
+ case VISU::eTETRA4: return MED_TETRA4;
+ case VISU::eHEXA8: return MED_HEXA8;
+ case VISU::ePENTA6: return MED_PENTA6;
+ case VISU::ePYRA5: return MED_PYRA5;
+
+ case VISU::eSEG3: return MED_SEG3;
+ case VISU::eTRIA6: return MED_TRIA6;
+ case VISU::eQUAD8: return MED_QUAD8;
+ case VISU::eTETRA10: return MED_TETRA10;
+ case VISU::eHEXA20: return MED_HEXA20;
+ case VISU::ePENTA15: return MED_PENTA15;
+ case VISU::ePYRA13: return MED_PYRA13;
+ }
+ return medGeometryElement(-1);
+ }
//---------------------------------------------------------------
medGeometryElement
return aMeshOnEntity;
}
-
+
+
+ PCSubProfile
+ CrSubProfile(const VISU::PCMesh theMesh,
+ const VISU::PCField theField,
+ const VISU::TCMeshOnEntity& theMeshOnEntity,
+ SALOME_MED::medGeometryElement theMGeom,
+ // SALOME_MED::long_array_var theGeom2Profile)
+ int nbElts)
+ {
+ if (MYDEBUG) MESSAGE("CrSubProfile");
+ VISU::EGeometry aEGeom = MEDGeom2VISU(theMGeom);
+ vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
+
+ PCSubProfile aSubProfile(new TCSubProfile());
+ aSubProfile->myGeom = aEGeom;
+ aSubProfile->myMGeom = theMGeom;
+ aSubProfile->myStatus = eAddAll;
+ if(MYDEBUG) MESSAGE("theMGeom = "<<theMGeom);
+ TCellsFirstIndex::const_iterator aTimeStampIter = (theMeshOnEntity.myCellsFirstIndex).find(theMGeom);
+ if(aTimeStampIter == (theMeshOnEntity.myCellsFirstIndex).end() &&
+ theMGeom != SALOME_MED::MED_POINT1)
+ aSubProfile->myStatus = eRemoveAll;
+ else if( aTimeStampIter == (theMeshOnEntity.myCellsFirstIndex).end() &&
+ theMGeom == SALOME_MED::MED_POINT1)
+ {
+ if(nbElts>0){
+ aSubProfile->myName = "";
+ aSubProfile->myStatus = eAddPart;
+
+ aSubProfile->myNbCells = nbElts;
+ aSubProfile->myCellsSize = aSubProfile->myNbCells;
+ }
+ }
+ else
+ {
+ if(nbElts>0){
+ aSubProfile->myName = "";
+ aSubProfile->myStatus = eAddPart;
+
+ aSubProfile->myNbCells = nbElts;
+ aSubProfile->myCellsSize = aSubProfile->myNbCells*aVNbNodes;
+ }
+ }
+
+ if (MYDEBUG) MESSAGE("CrSubProfile done");
+ return aSubProfile;
+ }
+
+ TProfileKey
+ GetProfileKey(const VISU::PCMesh theMesh,
+ const VISU::PCField theField,
+ const VISU::PCValForTime theValForTime,
+ const VISU::TCMeshOnEntity& theMeshOnEntity)
+ {
+ if (MYDEBUG) MESSAGE("GetProfileKey");
+
+ TProfileKey aProfileKey;
+
+ const TCellsFirstIndex& aFirstIndex = theMeshOnEntity.myCellsFirstIndex;
+ TCellsFirstIndex::const_iterator anIter = aFirstIndex.begin();
+ int aNbElts = 0;
+ if(anIter==aFirstIndex.end() &&
+ (theValForTime->myField->getSupport()->getEntity() == SALOME_MED::MED_NODE))
+ {
+ SALOME_MED::medGeometryElement aMGeom = SALOME_MED::MED_POINT1;
+
+ try{
+ aNbElts = theValForTime->myField->getSupport()->getNumberOfElements(SALOME_MED::MED_NONE);
+ if(MYDEBUG)MESSAGE("aMGeom="<<aMGeom<<" aNbElts="<<aNbElts);
+ } catch(...){
+ MESSAGE("Error in theValForTime->myField->getSupport()->getNumberOfElements(aMGeom);");
+ }
+
+ PCSubProfile aSubProfile = CrSubProfile(theMesh,
+ theField,
+ theMeshOnEntity,
+ aMGeom,
+ aNbElts);
+ aProfileKey.insert(aSubProfile);
+ }
+
+ for(; anIter != aFirstIndex.end(); anIter++){
+ SALOME_MED::medGeometryElement aMGeom = anIter->first;
+ try{
+ aNbElts = theValForTime->myField->getSupport()->getNumberOfElements(aMGeom);
+ if(MYDEBUG)MESSAGE("aMGeom="<<aMGeom<<" aNbElts="<<aNbElts);
+ } catch(...){
+ MESSAGE("Error in theValForTime->myField->getSupport()->getNumberOfElements(aMGeom);");
+ continue;
+ }
+ PCSubProfile aSubProfile = CrSubProfile(theMesh,
+ theField,
+ theMeshOnEntity,
+ aMGeom,
+ aNbElts);
+ aProfileKey.insert(aSubProfile);
+ }
+
+ if (MYDEBUG) MESSAGE("GetProfileKey done");
+ return aProfileKey;
+ }
+
+ void
+ InitProfile(VISU::PCMesh theMesh,
+ VISU::PCField theField,
+ VISU::PCValForTime theValForTime,
+ VISU::TCMeshOnEntity& theMeshOnEntity)
+ {
+ if (MYDEBUG) MESSAGE("InitProfile");
+
+ TProfileMap& aProfileMap = theMeshOnEntity.myProfileMap;
+
+ TProfileKey aProfileKey = GetProfileKey(theMesh,
+ theField,
+ theValForTime,
+ theMeshOnEntity);
+
+ TProfileMap::const_iterator anIter = aProfileMap.find(aProfileKey);
+ if(anIter != aProfileMap.end()){
+ theValForTime->myProfile = anIter->second;
+ if(MYDEBUG) MESSAGE("aProfileMap.find(aProfileKey) aProfile->myGeom=");
+ }else{
+ PCProfile aProfile(new TCProfile());
+ TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+
+ TProfileKey::const_iterator anIter = aProfileKey.begin();
+ for(; anIter != aProfileKey.end(); anIter++){
+ PCSubProfile aSubProfile(*anIter);
+
+ if(aProfile->myIsAll && aSubProfile->myStatus != eAddAll)
+ aProfile->myIsAll = false;
+
+ VISU::EGeometry aEGeom = aSubProfile->myGeom;
+ aGeom2SubProfile[aEGeom] = aSubProfile;
+ }
+
+ aProfileMap[aProfileKey] = aProfile;
+ theValForTime->myProfile = aProfile;
+ }
+ if (MYDEBUG) MESSAGE("InitProfile done");
+ }
+
+ void
+ LoadProfile(VISU::PCMesh theMesh,
+ VISU::PCField theField,
+ VISU::PCValForTime theValForTime,
+ VISU::PCMeshOnEntity theMeshOnEntity)
+ {
+ PCProfile aProfile = theValForTime->myProfile;
+ if (MYDEBUG) MESSAGE("LoadProfile aProfile->myIsDone="<<aProfile->myIsDone);
+ if(aProfile->myIsDone)
+ return;
+
+ const TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+ TGeom2SubProfile::const_iterator aGeom2SubProfileIter = aGeom2SubProfile.begin();
+ if(aGeom2SubProfileIter==aGeom2SubProfile.end()){
+ MESSAGE("Warning! No geom 2 sub profile");
+ }
+ for(;aGeom2SubProfileIter!=aGeom2SubProfile.end();aGeom2SubProfileIter++){
+ VISU::EGeometry aEGeom = aGeom2SubProfileIter->first;
+ medGeometryElement aMGeom = VISUGeomToMED(aEGeom);
+ PCSubProfile aSubProfile = aGeom2SubProfileIter->second;
+ SALOME_MED::long_array_var aGeom2ProfileIds;
+ std::vector<int> aGeom2Profile;
+ if(!theValForTime->myField->getSupport()->isOnAllElements()){
+ cout << __LINE__ << endl;
+ try{
+ if(aMGeom == SALOME_MED::MED_POINT1)
+ aGeom2ProfileIds = theValForTime->myField->getSupport()->getNumberFromFile(SALOME_MED::MED_NONE);
+ else
+ aGeom2ProfileIds = theValForTime->myField->getSupport()->getNumberFromFile(aMGeom);
+ int aLen = aGeom2ProfileIds->length();
+ if(MYDEBUG) MESSAGE(" - aMGeom="<<aMGeom<<"; aNbCells="<<aLen);
+ for(int i=0;i<aLen;i++){
+ int anId = aGeom2ProfileIds[i];
+ aGeom2Profile.push_back(anId);
+ cout << "------------------------------->" << anId << endl;
+ }
+ cout << endl;
+ } catch(...) {
+ continue;
+ }
+ } else {
+ cout << __LINE__ << endl;
+ SALOME_MED::medEntityMesh aMEntity = theValForTime->myField->getSupport()->getEntity();
+ int aNbElts = theMesh->myMesh->getNumberOfElements(aMEntity,aMGeom);
+ for(int i=0;i<aNbElts;i++) aGeom2Profile.push_back(i+1);
+ }
+ if(aGeom2Profile.size()>0){
+ TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
+ int aSize = aGeom2Profile.size();
+ aSubMeshID.resize(aSize);
+
+
+ for(int anId = 0; anId < aSize; anId++){
+ aSubMeshID[anId] = aGeom2Profile[anId]-1; // ENKENKENKENKENEKENKENKN
+ }
+ }
+
+ }
+
+
+ aProfile->myIsDone = true;
+ if (MYDEBUG) MESSAGE("LoadProfile done");
+ }
}
TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
aCell2Connect.resize(aNbElem);
+ if(MYDEBUG) MESSAGE("LoadPoints - aNbElem="<<aNbElem);
for(int iElem = 0; iElem < aNbElem; iElem++)
aCell2Connect[iElem] = TConnect(1,iElem);
}
//Workaround for MED Component data structure
int aSize = aCell2Connect.size();
- if(MYDEBUG) MESSAGE("LoadCellsOnEntity - aCounter = "<<aCounter<<"; aSize = "<<aSize);
- theMeshOnEntity->myCellsFirstIndex[aMGeom] = TCMeshOnEntity::TIndexAndSize(aCounter,aSize);
+ if(MYDEBUG) MESSAGE("LoadCellsOnEntity - aCounter = "<<aCounter<<"; aSize = "<<aSize<<"; aMGeom = "<<aMGeom);
+ theMeshOnEntity->myCellsFirstIndex[aMGeom] = TIndexAndSize(aCounter,aSize);
aCounter += aSize;
}
}
VISU::PCValForTime theValForTime,
VISU::PCMeshOnEntity theMeshOnEntity)
{
+ if(MYDEBUG) MESSAGE("ImportField");
+
int aNbComp = theField->myNbComp;
- if(theField->myEntity == NODE_ENTITY){
- VISU::EGeometry aEGeom = VISU::ePOINT1;
- int aNbGauss = theValForTime->GetNbGauss(aEGeom);
- const TNamedPointCoords& aCoords = theMesh->myNamedPointCoords;
- int aNbElem = aCoords.GetNbPoints();
-
- if(MYDEBUG) MESSAGE("ImportField - aNbElem = "<<aNbElem);
-
- TMeshValue& aMeshValue = theValForTime->GetMeshValue(VISU::ePOINT1);
- aMeshValue.Init(aNbElem,aNbGauss,aNbComp);
- for(int iElem = 0, anId = 0; iElem < aNbElem; iElem++){
- TValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem);
- for(int iGauss = 0; iGauss < aNbGauss; iGauss++){
- TValueSlice& aValueSlice = aValueSliceArr[iGauss];
- for(int iComp = 0; iComp < aNbComp; iComp++){
- aValueSlice[iComp] = theArray[anId++];
+
+ if(MYDEBUG) MESSAGE("- aNbComp = "<<aNbComp);
+
+ CORBA::String_var aSupportName = theMeshOnEntity->mySupport->getName();
+
+ if(theMeshOnEntity->mySupport->isOnAllElements() &&
+ strcmp(aSupportName.in(),"SupportOnAll_MED_") > 1){
+
+ if(theField->myEntity == NODE_ENTITY){
+ VISU::EGeometry aEGeom = VISU::ePOINT1;
+ int aNbGauss = theValForTime->GetNbGauss(aEGeom);
+ const TNamedPointCoords& aCoords = theMesh->myNamedPointCoords;
+ int aNbElem = aCoords.GetNbPoints();
+
+ if(MYDEBUG) MESSAGE("ImportField - aNbElem = "<<aNbElem);
+
+ TMeshValue& aMeshValue = theValForTime->GetMeshValue(VISU::ePOINT1);
+ aMeshValue.Init(aNbElem,aNbGauss,aNbComp);
+ for(int iElem = 0, anId = 0; iElem < aNbElem; iElem++){
+ TValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem);
+ for(int iGauss = 0; iGauss < aNbGauss; iGauss++){
+ TValueSlice& aValueSlice = aValueSliceArr[iGauss];
+ for(int iComp = 0; iComp < aNbComp; iComp++){
+ aValueSlice[iComp] = theArray[anId++];
+ }
+ }
+ }
+ } else {
+ SALOME_MED::medGeometryElement* aGeomElems;
+ const TEntity& aVEntity = theField->myEntity;
+ int iGeomEnd = GetEntity2Geom(aVEntity,aGeomElems);
+ for(int iGeom = 0; iGeom < iGeomEnd; iGeom++){
+ SALOME_MED::medGeometryElement aMGeom = aGeomElems[iGeom];
+ VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
+ int aNbGauss = theValForTime->GetNbGauss(aEGeom);
+ const TCellsFirstIndex& aCellsFirstIndex = theMeshOnEntity->myCellsFirstIndex;
+ TCellsFirstIndex::const_iterator aCellsFirstIndexIter = aCellsFirstIndex.find(aMGeom);
+ if(aCellsFirstIndexIter != aCellsFirstIndex.end()){
+ const TIndexAndSize& aIndexAndSize = aCellsFirstIndexIter->second;
+ if(MYDEBUG)
+ MESSAGE("ImportField - aMGeom = "<<aMGeom<<
+ "; aIndexAndSize = {"<<aIndexAndSize.first<<
+ ","<<aIndexAndSize.second<<"}");
+
+ int aNbElem = aIndexAndSize.second;
+ int aStart = aIndexAndSize.first*aNbComp;
+ TMeshValue& aMeshValue = theValForTime->GetMeshValue(aEGeom);
+ aMeshValue.Init(aNbElem,aNbGauss,aNbComp);
+ for(int iElem = 0, anId = 0; iElem < aNbElem; iElem++, anId += aNbComp){
+ TValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem);
+ for(int iGauss = 0; iGauss < aNbGauss; iGauss++){
+ TValueSlice& aValueSlice = aValueSliceArr[iGauss];
+ for(int iComp = 0; iComp < aNbComp; iComp++)
+ aValueSlice[iComp] = theArray[aStart+anId+iComp];
+ }
+ }
}
}
}
- }else{
- SALOME_MED::medGeometryElement* aGeomElems;
- const TEntity& aVEntity = theField->myEntity;
- int iGeomEnd = GetEntity2Geom(aVEntity,aGeomElems);
- for(int iGeom = 0; iGeom < iGeomEnd; iGeom++){
- SALOME_MED::medGeometryElement aMGeom = aGeomElems[iGeom];
- VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
+ return 1;
+ }
+
+ if(MYDEBUG) MESSAGE("Loading profile");
+ theField->myDataSize = 0;
+
+ InitProfile(theMesh,theField,theValForTime,theMeshOnEntity);
+
+ LoadProfile(theMesh,theField,theValForTime,theMeshOnEntity);
+
+ PCProfile aProfile = theValForTime->myProfile;
+ TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+
+ TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
+ for(; anIter != aGeom2SubProfile.end(); anIter++){
+ VISU::EGeometry aEGeom = anIter->first;
+ PCSubProfile aSubProfile(anIter->second);
+
+ int aNbElem = aSubProfile->myNbCells;
+ theField->myDataSize += aNbElem*aNbComp;
+
+ if(aSubProfile->myStatus != eRemoveAll){
int aNbGauss = theValForTime->GetNbGauss(aEGeom);
- const TCMeshOnEntity::TCellsFirstIndex& aCellsFirstIndex = theMeshOnEntity->myCellsFirstIndex;
- TCMeshOnEntity::TCellsFirstIndex::const_iterator aCellsFirstIndexIter = aCellsFirstIndex.find(aMGeom);
- if(aCellsFirstIndexIter != aCellsFirstIndex.end()){
- const TCMeshOnEntity::TIndexAndSize& aIndexAndSize = aCellsFirstIndexIter->second;
- if(MYDEBUG)
- MESSAGE("ImportField - aMGeom = "<<aMGeom<<
- "; aIndexAndSize = {"<<aIndexAndSize.first<<
- ","<<aIndexAndSize.second<<"}");
-
- int aNbElem = aIndexAndSize.second;
- int aStart = aIndexAndSize.first*aNbComp;
- TMeshValue& aMeshValue = theValForTime->GetMeshValue(aEGeom);
- aMeshValue.Init(aNbElem,aNbGauss,aNbComp);
- for(int iElem = 0, anId = 0; iElem < aNbElem; iElem++, anId += aNbComp){
- TValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem);
- for(int iGauss = 0; iGauss < aNbGauss; iGauss++){
- TValueSlice& aValueSlice = aValueSliceArr[iGauss];
- for(int iComp = 0; iComp < aNbComp; iComp++)
- aValueSlice[iComp] = theArray[aStart+anId+iComp];
+
+ if(MYDEBUG) MESSAGE("- aEGeom = "<<aEGeom<<
+ "; aNbElem = "<<aNbElem<<
+ "; aNbGauss = "<<aNbGauss);
+
+ TMeshValue& aVMeshValue = theValForTime->GetMeshValue(aEGeom);
+ aVMeshValue.Init(aNbElem,aNbGauss,aNbComp);
+
+ for(int iElem = 0, anId = 0; iElem < aNbElem; iElem++){
+ TValueSliceArr aVValueSliceArr = aVMeshValue.GetGaussValueSliceArr(iElem);
+ for(int iGauss = 0; iGauss < aNbGauss; iGauss++){
+ TValueSlice& aVValueSlice = aVValueSliceArr[iGauss];
+ for(int iComp = 0; iComp < aNbComp; iComp++){
+ aVValueSlice[iComp] = theArray[anId++];
}
}
}
VISU::PField theField,
VISU::PCValForTime theValForTime)
{
+ MESSAGE("VISU_MEDConvertor::LoadField");
//Check on loading already done
PIDMapperFilter anIDMapperFilter = theValForTime->myIDMapperFilter;
if(anIDMapperFilter->myIsVTKDone)
theValForTime->myProfile = aProfile;
SALOME_MED::FIELD_var aMEDField = theValForTime->myField;
+
+ SALOME_MED::SUPPORT_var aMEDSupport = aMEDField->getSupport();
+
+ if(aMEDSupport->isOnAllElements()) aProfile->myIsDone = true;
+
SALOME_MED::FIELDDOUBLE_ptr aFieldDouble = SALOME_MED::FIELDDOUBLE::_narrow(aMEDField);
if(!aFieldDouble->_is_nil()){
SALOME_MED::double_array_var anArray = aFieldDouble->getValue(SALOME_MED::MED_FULL_INTERLACE);
anIDMapperFilter->myIsVTKDone = true;
+ MESSAGE("VISU_MEDConvertor::LoadField done");
return 1;
}