TInt aNbConn = GetNbPolygoneConn(*theMeshInfo,theEntity,theGeom,theConn);
PPolygoneInfo anInfo = CrPolygoneInfo(theMeshInfo,aNbElem,aNbConn,theEntity,theGeom,theConn);
GetPolygoneInfo(*anInfo);
+#ifdef _DEBUG_
+ TElemNum aConn = anInfo->GetConnectivite();
+ TElemNum aIndex = anInfo->GetIndex();
+ TInt aNbIndex = aIndex.size();
+ TInt aIndex0 = aIndex[0];
+ INITMSG(MYDEBUG,"theGeom = "<<theGeom<<"; aNbElem = "<<aNbIndex-1<<": ");
+ for(TInt iElem = 1; iElem < aNbIndex; iElem++){
+ for (TInt i = aIndex0; i < aIndex[iElem];i++)
+ ADDMSG(MYVALUEDEBUG,aConn[i-1]<<",");
+ ADDMSG(MYDEBUG," ");
+ aIndex0 = aIndex[iElem];
+ }
+ ADDMSG(MYDEBUG,endl);
+ ADDMSG(MYDEBUG," Indexes :");
+ for(TInt iElem = 0; iElem < aIndex.size(); iElem++){
+ ADDMSG(MYVALUEDEBUG,aIndex[iElem]<<",");
+ }
+ ADDMSG(MYDEBUG,endl);
+#endif
return anInfo;
}
GetNbPolyedreConnF(*theMeshInfo,theConn,aNbFaces,aNbConn);
PPolyedreInfo anInfo = CrPolyedreInfo(theMeshInfo,aNbElem,aNbConn,aNbFaces,theEntity,theGeom,theConn);
GetPolyedreInfo(*anInfo);
+#ifdef _DEBUG_
+ TElemNum aConn = anInfo->GetConnectivite();
+ TElemNum aFacesIndex = anInfo->GetFacesIndex();
+ TElemNum aIndex = anInfo->GetIndex();
+
+ TInt aNbIndex = aIndex.size();
+
+ for (int aNp = 0; aNp < aNbIndex-1;aNp++){
+ if (anInfo->IsElemNames())
+ ADDMSG(MYDEBUG,anInfo->GetElemName(aNp)<<endl);
+ else
+ ADDMSG(MYDEBUG,"POLYEDRE "<<aNp+1<<endl);
+
+ for (int aNf = aIndex[aNp]-1;aNf < aIndex[aNp+1]-1;aNf++){
+ ADDMSG(MYDEBUG,"Face "<<aNf-aIndex[aNp]+2<<": [");
+ for (int aNc = aFacesIndex[aNf]-1; aNc < aFacesIndex[aNf+1]-1;aNc++){
+ ADDMSG(MYDEBUG," "<<aConn[aNc]);
+ }
+ ADDMSG(MYDEBUG," ]"<<endl;);
+ }
+ }
+#endif
return anInfo;
}
SetFamilyInfo(theInfo,eLECTURE_AJOUT,theErr);
}
+ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ void TVWrapper::GetNames(TElemInfo& theInfo,
+ TInt nb,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+ if(theErr && !*theErr)
+ return;
+
+ MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+
+ med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theTEntity);
+ med_geometrie_element& aGeom = static_cast<med_geometrie_element>(theTGeom);
+
+ TErr aRet = MEDnomLire(myFile->Id(),
+ &aMeshInfo.myName[0],
+ &theInfo.myElemNames[0],
+ nb,
+ anEntity,
+ aGeom);
+
+ theInfo.myIsElemNames = (theInfo.myElemNames).empty()? EBooleen(0) : EBooleen(1) ;
+
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"GetNames - MEDnomLire(...)");
+ }
+
+ void TVWrapper::GetNumeration(TElemInfo& theInfo,
+ TInt nb,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+ if(theErr && !*theErr)
+ return;
+
+ MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+
+ med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theTEntity);
+ med_geometrie_element& aGeom = static_cast<med_geometrie_element>(theTGeom);
+
+ TErr aRet = MEDnumLire(myFile->Id(),
+ &aMeshInfo.myName[0],
+ &theInfo.myElemNum[0],
+ nb,
+ anEntity,
+ aGeom);
+
+ theInfo.myIsElemNum = (theInfo.myElemNum).empty()? EBooleen(0) : EBooleen(1) ;
+
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"GetNumeration - MEDnumLire(...)");
+ }
+
+ void TVWrapper::GetFamilies(TElemInfo& theInfo,
+ TInt nb,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+ if(theErr && !*theErr)
+ return;
+
+ MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+
+ med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theTEntity);
+ med_geometrie_element& aGeom = static_cast<med_geometrie_element>(theTGeom);
+
+ TErr aRet = MEDfamLire(myFile->Id(),
+ &aMeshInfo.myName[0],
+ &theInfo.myFamNum[0],
+ nb,
+ anEntity,
+ aGeom);
+
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"GetFamilies - MEDfamLire(...)");
+ }
+
+ void TVWrapper::SetNames(const TElemInfo& theInfo,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ TErr* theErr)
+ {
+ SetNames(theInfo,eLECTURE_ECRITURE,theTEntity,theTGeom,theErr);
+ }
+
+ void TVWrapper::SetNames(const TElemInfo& theInfo,
+ EModeAcces theMode,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,theMode,theErr);
+
+ if(theErr && !*theErr)
+ return;
+
+ MED::TElemInfo& anInfo = const_cast<MED::TElemInfo&>(theInfo);
+ MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+
+ med_booleen& anIsElemNames = static_cast<med_booleen>(theInfo.myIsElemNames);
+ med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theTEntity);
+ med_geometrie_element& aGeom = static_cast<med_geometrie_element>(theTGeom);
+
+ TErr aRet = 0;
+ if (anIsElemNames){
+ aRet = MEDnomEcr(myFile->Id(),
+ &aMeshInfo.myName[0],
+ &anInfo.myElemNames[0],
+ anInfo.myElemNames.size(),
+ anEntity,
+ aGeom);
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"SetNames - MEDnomEcr(...)");
+ }
+ }
+
+ void TVWrapper::SetNumeration(const TElemInfo& theInfo,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ TErr* theErr)
+ {
+ SetNumeration(theInfo,eLECTURE_ECRITURE,theTEntity,theTGeom,theErr);
+ }
+
+ void TVWrapper::SetNumeration(const TElemInfo& theInfo,
+ EModeAcces theMode,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,theMode,theErr);
+
+ if(theErr && !*theErr)
+ return;
+
+ MED::TElemInfo& anInfo = const_cast<MED::TElemInfo&>(theInfo);
+ MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+
+ med_booleen& anIsElemNum = static_cast<med_booleen>(theInfo.myIsElemNum);
+ med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theTEntity);
+ med_geometrie_element& aGeom = static_cast<med_geometrie_element>(theTGeom);
+
+ TErr aRet = 0;
+ if (anIsElemNum){
+ aRet = MEDnumEcr(myFile->Id(),
+ &aMeshInfo.myName[0],
+ &anInfo.myElemNum[0],
+ anInfo.myElemNum.size(),
+ anEntity,
+ aGeom);
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"SetNumeration - MEDnumEcr(...)");
+ }
+ }
+
+ void TVWrapper::SetFamilies(const TElemInfo& theInfo,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ TErr* theErr)
+ {
+ SetFamilies(theInfo,eLECTURE_ECRITURE,theTEntity,theTGeom,theErr);
+ }
+
+ void TVWrapper::SetFamilies(const TElemInfo& theInfo,
+ EModeAcces theMode,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,theMode,theErr);
+
+ if(theErr && !*theErr)
+ return;
+
+ MED::TElemInfo& anInfo = const_cast<MED::TElemInfo&>(theInfo);
+ MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+
+ med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theTEntity);
+ med_geometrie_element& aGeom = static_cast<med_geometrie_element>(theTGeom);
+
+ TErr aRet = MEDfamEcr(myFile->Id(),
+ &aMeshInfo.myName[0],
+ &anInfo.myFamNum[0],
+ anInfo.myFamNum.size(),
+ anEntity,
+ aGeom);
+
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"SetFamilies - MEDfamEcr(...)");
+ }
+ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TInt TVWrapper::GetNbNodes(const MED::TMeshInfo& theMeshInfo,
TErr* theErr)
{
*theErr = aRet;
else if(aRet < 0)
EXCEPTION(runtime_error,"GetPolygoneInfo - MEDpolygoneInfo(...)");
+
+
+ GetNames(theInfo,aNbElem,theInfo.myTEntity,ePOLYGONE,&aRet);
+ if(theErr)
+ *theErr = aRet;
+
+ GetNumeration(theInfo,aNbElem,theInfo.myTEntity,ePOLYGONE,&aRet);
+ if(theErr)
+ *theErr = aRet;
+
+ GetFamilies(theInfo,aNbElem,theInfo.myTEntity,ePOLYGONE,&aRet);
+ if(theErr)
+ *theErr = aRet;
}
void TVWrapper::SetPolygoneInfo(const MED::TPolygoneInfo& theInfo,
MED::TPolygoneInfo& anInfo = const_cast<MED::TPolygoneInfo&>(theInfo);
MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
- med_booleen& anIsElemNames = static_cast<med_booleen>(theInfo.myIsElemNames);
- med_booleen& anIsElemNum = static_cast<med_booleen>(theInfo.myIsElemNum);
med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theInfo.myTEntity);
med_connectivite& aConn = static_cast<med_connectivite>(theInfo.myTConn);
else if(aRet < 0)
EXCEPTION(runtime_error,"SetPolygoneInfo - MEDpolygoneConnEcr(...)");
- if (anIsElemNames){
- aRet = MEDnomEcr(myFile->Id(),
- &aMeshInfo.myName[0],
- &anInfo.myElemNames[0],
- anInfo.myElemNames.size(),
- anEntity,
- MED_POLYGONE);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetPolygoneInfo - MEDnomEcr(...)");
- }
-
- if (anIsElemNum){
- aRet = MEDnumEcr(myFile->Id(),
- &aMeshInfo.myName[0],
- &anInfo.myElemNum[0],
- anInfo.myElemNum.size(),
- anEntity,
- MED_POLYGONE);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetPolygoneInfo - MEDnumEcr(...)");
- }
+ SetNames(anInfo,theInfo.myTEntity,ePOLYGONE,&aRet);
+ if(theErr)
+ *theErr = aRet;
- aRet = MEDfamEcr(myFile->Id(),
- &aMeshInfo.myName[0],
- &anInfo.myFamNum[0],
- anInfo.myFamNum.size(),
- anEntity,
- MED_POLYGONE);
+ SetNumeration(anInfo,theInfo.myTEntity,ePOLYGONE,&aRet);
+ if(theErr)
+ *theErr = aRet;
+ SetFamilies(anInfo,theInfo.myTEntity,ePOLYGONE,&aRet);
if(theErr)
*theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetPolygoneInfo - MEDfamEcr(...)");
}
TInt TVWrapper::GetNbPolygones(const MED::TMeshInfo& theMeshInfo,
*theErr = aRet;
else if(aRet < 0)
EXCEPTION(runtime_error,"GetPolygoneInfo - MEDpolyedreConnLire(...)");
+
+ GetNames(theInfo,aNbElem,theInfo.myTEntity,ePOLYEDRE,&aRet);
+ if(theErr)
+ *theErr = aRet;
+
+ GetNumeration(theInfo,aNbElem,theInfo.myTEntity,ePOLYEDRE,&aRet);
+ if(theErr)
+ *theErr = aRet;
+
+ GetFamilies(theInfo,aNbElem,theInfo.myTEntity,ePOLYEDRE,&aRet);
+ if(theErr)
+ *theErr = aRet;
}
void TVWrapper::SetPolyedreInfo(const TPolyedreInfo& theInfo,
TGeom& theGeom,
TErr* theErr)
{
+ theEntity = EEntiteMaillage(-1);
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
+
if(theErr){
*theErr &= !theEntityInfo.empty();
if(!*theErr)
const med_geometrie_element& aGeom = static_cast<const med_geometrie_element>(anGeomIter->first);
TInt aTmp = MEDnPasdetemps(myFile->Id(),&anInfo.myName[0],anEntity,aGeom);
aNbTimeStamps = max(aTmp,aNbTimeStamps);
+ if (aNbTimeStamps<1)
+ continue;
BEGMSG(MYDEBUG,"GetNbTimeStamps aNbTimeStamps="<<aTmp<<"; aGeom="<<aGeom<<"; anEntity="<<anEntity<<"\n");
if(aTmp){
theEntity = EEntiteMaillage(anEntity);
+ ADDMSG(MYDEBUG,"theEntity="<<theEntity<<"\n");
theGeom[EGeometrieElement(aGeom)] = anGeomIter->second;
}
}
if(aRet >= 0)
for(TInt i = 0; i < iEnd; i++) {
aValue[i] = anArray[i];
- MSG(MYDEBUG," "<<anArray[i]);
+ ADDMSG(MYDEBUG," "<<anArray[i]);
}
+ ADDMSG(MYDEBUG,endl);
break;
}
default: {
TErr* theErr = NULL);
+ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ virtual
+ void
+ GetNames(TElemInfo& theInfo,
+ TInt nb,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ TErr* theErr = NULL);
+
+ virtual
+ void
+ GetNumeration(TElemInfo& theInfo,
+ TInt nb,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ TErr* theErr = NULL);
+
+ virtual
+ void
+ GetFamilies(TElemInfo& theInfo,
+ TInt nb,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ TErr* theErr = NULL);
+
+ virtual
+ void
+ SetNames(const TElemInfo& theInfo,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ TErr* theErr = NULL);
+
+ void
+ SetNames(const TElemInfo& theInfo,
+ EModeAcces theMode,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ TErr* theErr = NULL);
+
+ virtual
+ void
+ SetNumeration(const TElemInfo& theInfo,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ TErr* theErr = NULL);
+ void
+ SetNumeration(const TElemInfo& theInfo,
+ EModeAcces theMode,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ TErr* theErr = NULL);
+
+ virtual
+ void
+ SetFamilies(const TElemInfo& theInfo,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ TErr* theErr = NULL);
+ void
+ SetFamilies(const TElemInfo& theInfo,
+ EModeAcces theMode,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ TErr* theErr = NULL);
+
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
virtual
TInt