aMeshOnEntity->myEntity = aVEntity;
aMeshOnEntity->myMeshName = aMeshName;
aMeshOnEntity->myGeom2Size = aGeom2Size;
-// TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
+ TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
INITMSG(MYDEBUG,
"- aMEntity = "<<aMEntity<<
aMeshOnEntity->myNbCells = theGrilleInfo->GetNbNodes();
aMeshOnEntity->myCellsSize = 2*theGrilleInfo->GetNbNodes();
- // must be implemented (shadow point for GRILLE STANDARD,CARTESIAN,...)
-// for(TInt iElem = 0; iElem < theMesh->myNbPoints; iElem++){
-// TInt aFamId = theNodeInfo->GetFamNum(iElem);
-// if(aFamId != 0)
-// aFamilyID2CellsSize[aFamId] += 2;
-// }
+ if((theGrilleInfo->myFamNumNode).size() > 0)
+ for(TInt iElem = 0; iElem < theGrilleInfo->GetNbNodes(); iElem++){
+ TInt aFamId = theGrilleInfo->GetFamNumNode(iElem);
+ if(aFamId != 0)
+ aFamilyID2CellsSize[aFamId] += 2;
+ }
INITMSG(MYDEBUG,
"- myNbCells = "<<aMeshOnEntity->myNbCells<<
"; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
endl);
-// for(TInt iElem = 0; iElem < aNbElem; iElem++){
-// TInt aFamId = aCellInfo->GetFamNum(iElem);
-// if(aFamId != 0)
-// aFamilyID2CellsSize[aFamId] += aVNbNodes + 1;
-// }
+ if((theGrilleInfo->myFamNum).size() > 0)
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ TInt aFamId = theGrilleInfo->GetFamNum(iElem);
+ if(aFamId != 0)
+ aFamilyID2CellsSize[aFamId] += aVNbNodes + 1;
+ }
}
}
}
}
+
+ /*!
+ * Build grille family map
+ */
+ void
+ BuildGrilleFamilyMap(PMEDMesh theMesh,
+ const MED::TEntityInfo& theEntityInfo,
+ const MED::TFamilyInfoSet& theFamilyInfoSet,
+ MED::PWrapper theMEDWrapper)
+ {
+ TTimerLog aTimerLog(MYDEBUG,"BuildGrilleFamilyMap");
+ INITMSG(MYDEBUG,"BuildGrilleFamilyMap\n");
+
+ TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
+
+ MED::TEntityInfo::const_iterator aEntityIter = theEntityInfo.begin();
+
+ const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
+ MED::PGrilleInfo aGrilleInfo = theMEDWrapper->GetPGrilleInfo(aMeshInfo);
+
+ const MED::TFamilyID2NbCells& aFam2NbCells = MED::GetFamilyID2NbCells(aGrilleInfo);
+
+ MED::TFamilyInfoSet::iterator aFamInter = theFamilyInfoSet.begin();
+ for(;aFamInter != theFamilyInfoSet.end();aFamInter++){
+ TInt anId = (*aFamInter)->GetId();
+
+ if(anId == 0)
+ continue;
+
+ std::string aFamilyName = (*aFamInter)->GetName();
+ const MED::EEntiteMaillage& aMEntity = MED::GetEntityByFamilyId(aGrilleInfo,
+ anId);
+ TEntity aVEntity = MEDEntityToVTK(aMEntity);
+
+ PMEDMeshOnEntity aMeshOnEntity;
+ TMeshOnEntityMap::iterator aMeshOnEntityIter = aMeshOnEntityMap.find(aVEntity);
+ if(aMeshOnEntityIter != aMeshOnEntityMap.end())
+ aMeshOnEntity = aMeshOnEntityIter->second;
+
+ TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+
+ PMEDFamily aFamily = aFamilyMap[aFamilyName](new TMEDFamily());
+ aFamily->myId = anId;
+ aFamily->myEntity = aVEntity;
+ aFamily->myName = aFamilyName;
+ aFamily->myNbCells = 0;
+ aFamily->myCellsSize = 0;
+
+ TFamilyID2CellsSize::iterator aFamilyid2CellsSizeIter = (aMeshOnEntity->myFamilyID2CellsSize).find(anId);
+ if(aFamilyid2CellsSizeIter != (aMeshOnEntity->myFamilyID2CellsSize).end())
+ aFamily->myCellsSize = aFamilyid2CellsSizeIter->second;
+ MED::TFamilyID2NbCells::const_iterator aFam2NbCellsIter = aFam2NbCells.find(anId);
+ if(aFam2NbCellsIter != aFam2NbCells.end())
+ aFamily->myNbCells = aFam2NbCellsIter->second;
+
+ INITMSG(MY_FAMILY_DEBUG,
+ "- aFamilyName =|"<<aFamily->myName<<"|"
+ << "; myId = "<<aFamily->myId
+ << "; aNbAttr = "<<(*aFamInter)->GetNbAttr()
+ << "; aNbGroup = "<<(*aFamInter)->GetNbGroup()
+ << "; aVEntity = "<<aVEntity
+ << "; myNbCells = "<<aFamily->myNbCells
+ << "; myCellsSize = "<<aFamily->myCellsSize
+ <<endl);
+
+
+ }
+ }
//---------------------------------------------------------------
void
INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<"'\n");
+ MED::EMaillage aType = aMeshInfo->GetType();
+
MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo);
MED::TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo =
#endif
MED::TFamilyInfoSet aFamilyInfoSet = MED::GetFamilyInfoSet(aMed,aMeshInfo);
- BuildFamilyMap(aMesh,
- anEntityInfo,
- anEntity2TGeom2ElemInfo,
- aFamilyInfoSet,
- aMed);
+ if(aType == MED::eNON_STRUCTURE)
+ BuildFamilyMap(aMesh,
+ anEntityInfo,
+ anEntity2TGeom2ElemInfo,
+ aFamilyInfoSet,
+ aMed);
+ else
+ BuildGrilleFamilyMap(aMesh,
+ anEntityInfo,
+ aFamilyInfoSet,
+ aMed);
BuildGroupMap(aMesh,
aFamilyInfoSet);
}catch(std::exception& exc){
MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
}catch(...){
- MSG(MYDEBUG,"Unknown exception !!!");
+ MSG(MYDEBUG,"Unknown exception !!!");
}
#endif
if(theFamily->myIsDone)
return 0;
+ const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
+ MED::EMaillage aType = aMeshInfo->GetType();
+
//Main part of code
- MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
- TInt aNbElem = aNodeInfo->GetNbElem();
-
- if(aNbElem > 0){
- TInt anId = theFamily->myId;
- TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
- for(TInt iElem = 0; iElem < aNbElem; iElem++)
- if(aNodeInfo->GetFamNum(iElem) == anId)
- aSubMeshID.push_back(iElem);
+ if(MED::eNON_STRUCTURE){
+ MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
+ TInt aNbElem = aNodeInfo->GetNbElem();
+
+ if(aNbElem > 0){
+ TInt anId = theFamily->myId;
+ TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
+ for(TInt iElem = 0; iElem < aNbElem; iElem++)
+ if(aNodeInfo->GetFamNum(iElem) == anId)
+ aSubMeshID.push_back(iElem);
+ }
+ } else {
+ MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(aMeshInfo);
+ TInt aNbElem = aGrilleInfo->GetNbNodes();
+
+ if(aNbElem > 0){
+ TInt anId = theFamily->myId;
+ TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
+ for(TInt iElem = 0; iElem < aNbElem; iElem++)
+ if(aGrilleInfo->GetFamNumNode(iElem) == anId)
+ aSubMeshID.push_back(iElem);
+ }
}
theFamily->myIsDone = true;
const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
TGeom2SubMeshID& aGeom2SubMeshID = theFamily->myGeom2SubMeshID;
+ MED::EMaillage aType = aMeshInfo->GetType();
const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
- MED::PElemInfo anElemInfo;
- switch(aMGeom){
- case MED::ePOLYGONE: {
- anElemInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
- break;
- }
- case MED::ePOLYEDRE: {
- anElemInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
- break;
- }
- default: {
- anElemInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
- break;
- }}
- if(anElemInfo){
- if(TInt aNbElem = anElemInfo->GetNbElem()){
- TSubMeshID aSubMeshID;
- for(TInt iElem = 0; iElem < aNbElem; iElem++)
- if(anElemInfo->GetFamNum(iElem) == anId)
- aSubMeshID.push_back(iElem);
- if(!aSubMeshID.empty()){
- VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
- INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
- aGeom2SubMeshID.insert(TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
+ if(aType == MED::eNON_STRUCTURE){
+ MED::PElemInfo anElemInfo;
+ switch(aMGeom){
+ case MED::ePOLYGONE: {
+ anElemInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
+ break;
+ }
+ case MED::ePOLYEDRE: {
+ anElemInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
+ break;
+ }
+ default: {
+ anElemInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
+ break;
+ }}
+ if(anElemInfo){
+ if(TInt aNbElem = anElemInfo->GetNbElem()){
+ TSubMeshID aSubMeshID;
+ for(TInt iElem = 0; iElem < aNbElem; iElem++)
+ if(anElemInfo->GetFamNum(iElem) == anId)
+ aSubMeshID.push_back(iElem);
+ if(!aSubMeshID.empty()){
+ VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
+ INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
+ aGeom2SubMeshID.insert(TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
+ }
+ }
+ }
+ } else {
+ MED::PGrilleInfo anElemInfo = theMed->GetPGrilleInfo(aMeshInfo);
+ if(anElemInfo){
+ TInt aNbElem = anElemInfo->GetNbCells();
+ if(aNbElem>0 && (aMGeom == anElemInfo->GetGeom()) ){
+ TSubMeshID aSubMeshID;
+ for(TInt iElem = 0; iElem < aNbElem; iElem++)
+ if(anElemInfo->GetFamNum(iElem) == anId)
+ aSubMeshID.push_back(iElem);
+ if(!aSubMeshID.empty()){
+ VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
+ INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
+ aGeom2SubMeshID.insert(TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
+ }
}
}
}
theInput->BuildEntities();
}
- QString aComment;
+ QString aComment,aTmp;
const TMeshMap& aMeshMap = theInput->GetMeshMap();
TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
if(aMeshOnEntityMap.empty())
continue;
-
- aComment.sprintf("myComment=MESH;myName=%s;myDim=%d",
- aMeshName.c_str(),
- aMesh->myDim);
+ aComment = "";
+ aComment.append("myComment=MESH;");
+ aComment.append("myName=");aComment.append(aMeshName);aComment.append(";");
+ aComment.append(aTmp.sprintf("myDim=%d",aMesh->myDim));
aMesh->myEntry =
CreateAttributes(theStudy,
theResultEntry,
aComment.latin1(),
true);
- aComment.sprintf("myComment=FAMILIES;myMeshName=%s",
- aMeshName.c_str());
+ aComment = "";
+ aComment.append("myComment=FAMILIES;");
+ aComment.append("myMeshName=");aComment.append(aMeshName);
string aSubMeshesEntry =
CreateAttributes(theStudy,
aMesh->myEntry,
continue;
}
- aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d",
- VISU::TENTITY,
- aMeshName.c_str(),
- anEntity);
+ aComment = "";
+ aComment.append(aTmp.sprintf("myComment=ENTITY;myType=%d;",VISU::TENTITY));
+ aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";");
+ aComment.append(aTmp.sprintf("myId=%d",anEntity));
+
aMeshOnEntity->myEntry =
CreateAttributes(theStudy,
theInput->BuildGroups();
}
- QString aComment;
+ QString aComment,aTmp;
const TMeshMap& aMeshMap = theInput->GetMeshMap();
TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
const string& aFamilyName = aFamilyMapIter->first;
const PFamily& aFamily = aFamilyMapIter->second;
- aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
- TFAMILY,
- aMeshName.c_str(),
- anEntity,
- aFamilyName.c_str());
+ aComment = "";
+ aComment.append(aTmp.sprintf("myComment=FAMILY;myType=%d;",TFAMILY));
+ aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";");
+ aComment.append(aTmp.sprintf("myEntityId=%d;",anEntity));
+ aComment.append("myName=");aComment.append(aFamilyName);
+
aFamily->myEntry =
CreateAttributes(theStudy,
aMeshOnEntity->myEntry,
//Importing groups
const TGroupMap& aGroupMap = aMesh->myGroupMap;
if(!aGroupMap.empty()){
- aComment.sprintf("myComment=GROUPS;myMeshName=%s",
- aMeshName.c_str());
+ aComment = "";
+ aComment.append("myComment=GROUPS;");
+ aComment.append("myMeshName=");aComment.append(aMeshName);
UpdateAttributes(theStudy,
aMesh->myGroupsEntry,
for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
const string& aGroupName = aGroupMapIter->first;
const PGroup& aGroup = aGroupMapIter->second;
- aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s",
- TGROUP,aMeshName.c_str(),aGroupName.c_str());
+ aComment = "";
+ aComment.sprintf("myComment=GROUP;myType=%d;",
+ TGROUP);
+ aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";");
+ aComment.append("myName=");aComment.append(aGroupName);
aGroup->myEntry =
CreateAttributes(theStudy,
aMesh->myGroupsEntry,
theInput->BuildFields();
}
- QString aComment;
+ QString aComment,aTmp;
const TMeshMap& aMeshMap = theInput->GetMeshMap();
TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
if(!anIsFieldsEntryUpdated){
- aComment.sprintf("myComment=FIELDS;myMeshName=%s",
- aMeshName.c_str());
-
+ aComment = "";
+ aComment.append("myComment=FIELDS;");
+ aComment.append("myMeshName=");aComment.append(aMeshName);
+
UpdateAttributes(theStudy,
aMesh->myFieldsEntry,
"",
const PField& aField = aFieldMapIter->second;
const TValField& aValField = aField->myValField;
QString aFieldNameWithUnit = GenerateFieldName(aFieldName,aField->myUnitNames[0]);
- aComment.sprintf("myComment=FIELD;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s;myNbTimeStamps=%d;myNumComponent=%d",
- TFIELD,
- aMeshName.c_str(),
- anEntity,
- aFieldName.c_str(),
- aValField.size(),
- aField->myNbComp);
+ aComment = "";
+ aComment.sprintf("myComment=FIELD;myType=%d;",TFIELD);
+ aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";");
+ aComment.append(aTmp.sprintf("myEntityId=%d;",anEntity));
+ aComment.append("myName=");aComment.append(aFieldName);aComment.append(";");
+ aComment.append(aTmp.sprintf("myNbTimeStamps=%d;",aValField.size()));
+ aComment.append(aTmp.sprintf("myNumComponent=%d",aField->myNbComp));
aField->myEntry =
CreateAttributes(theStudy,
aMesh->myFieldsEntry,
for(; aValFieldIter != aValField.end(); aValFieldIter++){
int aTimeStamp = aValFieldIter->first;
const PValForTime& aValForTime = aValFieldIter->second;
- aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
- TTIMESTAMP,
- aMeshName.c_str(),
- anEntity,
- aFieldName.c_str(),
- aTimeStamp,
- aField->myNbComp);
+ aComment = "";
+ aComment.sprintf("myComment=TIMESTAMP;myType=%d;",TTIMESTAMP);
+ aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";");
+ aComment.append(aTmp.sprintf("myEntityId=%d;",anEntity));
+ aComment.append("myFieldName=");aComment.append(aFieldName);aComment.append(";");
+ aComment.append(aTmp.sprintf("myTimeStampId=%d;myNumComponent=%d",aTimeStamp,aField->myNbComp));
+
string aTimeStampId = VISU_Convertor::GenerateName(aValForTime->myTime);
aValForTime->myEntry =
CreateAttributes(theStudy,