#ifdef _DEBUG_
static int MYDEBUG = 0;
-static int MYVALUEDEBUG = 0;
#else
static int MYDEBUG = 0;
-static int MYVALUEDEBUG = 0;
#endif
namespace MED{
MED::TEntityInfo::const_iterator anIter = theEntityInfo.begin();
for(; anIter != theEntityInfo.end(); anIter++){
const EEntiteMaillage& anEntity = anIter->first;
- if(anEntity == eNOEUD) continue;
const MED::TGeom& aGeom = anIter->second;
- TElemSet& aElemSet = aGroup[anEntity];
+ TElemMap& anElemMap = aGroup[anEntity];
+
+ if(anEntity == eNOEUD){
+ anElemMap[ePOINT1] = theWrapper.GetPNodeInfo(theMeshInfo);
+ continue;
+ }
+
MED::TGeom::const_iterator anGeomIter = aGeom.begin();
for(; anGeomIter != aGeom.end(); anGeomIter++){
const EGeometrieElement& aGeo = anGeomIter->first;
switch(aGeo){
- case ePOLYGONE:
- {
- PPolygoneInfo aPolygoneInfo = theWrapper.GetPPolygoneInfo(theMeshInfo,anEntity,aGeo);
- aElemSet.insert(aPolygoneInfo);
- break;
- }
- case ePOLYEDRE:
- {
- PPolyedreInfo aPolyedreInfo = theWrapper.GetPPolyedreInfo(theMeshInfo,anEntity,aGeo);
- aElemSet.insert(aPolyedreInfo);
- break;
- }
- default:
- {
- PCellInfo aCellInfo = theWrapper.GetPCellInfo(theMeshInfo,anEntity,aGeo);
- aElemSet.insert(aCellInfo);
- }
+ case ePOLYGONE: {
+ anElemMap[ePOLYGONE] = theWrapper.GetPPolygoneInfo(theMeshInfo,anEntity,aGeo);
+ break;
}
+ case ePOLYEDRE: {
+ anElemMap[ePOLYEDRE] = theWrapper.GetPPolyedreInfo(theMeshInfo,anEntity,aGeo);
+ break;
+ }
+ default: {
+ anElemMap[aGeo] = theWrapper.GetPCellInfo(theMeshInfo,anEntity,aGeo);
+ }}
+
}
}
ADDMSG(MYDEBUG,"\n");
TFamilyByEntity
GetFamiliesByEntity(TWrapper& theWrapper,
- const PNodeInfo& theNodeInfo,
const TElemGroup& theElemGroup,
const TFamilyGroup& theFamilyGroup)
{
typedef map<EEntiteMaillage,TFamilyIdSet> TFamilyIdByEntity;
TFamilyIdByEntity aFamilyIdByEntity;
- if(theNodeInfo!=0){
- if(TInt aNbElem = theNodeInfo->GetNbElem()){
- TFamilyIdSet& aFamilyIdSet = aFamilyIdByEntity[eNOEUD];
- for(TInt i = 0; i < aNbElem; i++){
- aFamilyIdSet.insert(theNodeInfo->GetFamNum(i));
- }
- }
- }
-
if(!theElemGroup.empty()){
TElemGroup::const_iterator anIter = theElemGroup.begin();
for(; anIter != theElemGroup.end(); anIter++){
const EEntiteMaillage& anEntity = anIter->first;
TFamilyIdSet& aFamilyIdSet = aFamilyIdByEntity[anEntity];
- const TElemSet& aElemSet = anIter->second;
- TElemSet::const_iterator anElemIter = aElemSet.begin();
- for(; anElemIter != aElemSet.end(); anElemIter++){
- const PElemInfo& aElemInfo = *anElemIter;
+ const TElemMap& anElemMap = anIter->second;
+ TElemMap::const_iterator anElemIter = anElemMap.begin();
+ for(; anElemIter != anElemMap.end(); anElemIter++){
+ const PElemInfo& aElemInfo = anElemIter->second;
if(TInt aNbElem = aElemInfo->GetNbElem()){
for(TInt i = 0; i < aNbElem; i++){
aFamilyIdSet.insert(aElemInfo->GetFamNum(i));
anFamilyByIdMapIter = aFamilyByIdMap.find(aFamilyId);
if(anFamilyByIdMapIter != aFamilyByIdMap.end()){
const PFamilyInfo& aFamilyInfo = anFamilyByIdMapIter->second;
- aFamilyByEntity[anEntity].insert(aFamilyInfo);
- INITMSG(MYDEBUG,
- "aFamilyName = '"<<aFamilyInfo->GetName()<<
- "' anId = "<<aFamilyInfo->GetId()<<"\n");
+ aFamilyByEntity[anEntity].insert(aFamilyInfo);
+ INITMSG(MYDEBUG,
+ "aFamilyName = '"<<aFamilyInfo->GetName()<<
+ "' anId = "<<aFamilyInfo->GetId()<<"\n");
}
}
}
namespace MED{
//---------------------------------------------------------------
- typedef std::set<PElemInfo> TElemSet;
- typedef std::map<EEntiteMaillage,TElemSet> TElemGroup;
+ typedef std::map<EGeometrieElement,PElemInfo> TElemMap;
+ typedef std::map<EEntiteMaillage,TElemMap> TElemGroup;
TElemGroup GetElemsByEntity(TWrapper& theWrapper,
const PMeshInfo& theMeshInfo,
typedef std::map<EEntiteMaillage,TFamilyGroup> TFamilyByEntity;
TFamilyByEntity GetFamiliesByEntity(TWrapper& theWrapper,
- const PNodeInfo& theNodeInfo,
const TElemGroup& theElemGroup,
const TFamilyGroup& theFamilyGroup);
SharedPtr() {}
template<class Y>
- explicit SharedPtr(Y * p): boost::shared_ptr<T>(p) {}
+ explicit SharedPtr(Y * p):
+ boost::shared_ptr<T>(p)
+ {}
template<class Y>
- SharedPtr(SharedPtr<Y> const & r): boost::shared_ptr<T>(r) {}
+ SharedPtr(SharedPtr<Y> const & r):
+ boost::shared_ptr<T>(r,boost::detail::polymorphic_cast_tag())
+ {}
- operator const T& () const { return *get();}
+ template<class Y>
+ SharedPtr& operator=(SharedPtr<Y> const & r)
+ {
+ boost::shared_ptr<T>(r,boost::detail::polymorphic_cast_tag()).swap(*this);
+ return *this;
+ }
- operator T& () { return *get();}
+ template<class Y> SharedPtr& operator()(Y * p) // Y must be complete
+ {
+ return operator=<Y>(SharedPtr<Y>(p));
+ }
+
+ operator const T& () const
+ {
+ return *get();
+ }
+
+ operator T& ()
+ {
+ return *get();
+ }
};
#ifdef _DEBUG_
string aName = anInfo->GetName();
- INITMSG(MYDEBUG,
- "aFamilyName = '"<<aName<<"'; andId = "<<anInfo->GetId()<<
- "; aNbAttr = "<<aNbAttr<<"; aNbGroup = "<<aNbGroup<<"\n");
+ INITMSG(MYDEBUG,"GetPFamilyInfo - aFamilyName = '"<<aName<<
+ "'; andId = "<<anInfo->GetId()<<
+ "; aNbAttr = "<<aNbAttr<<
+ "; aNbGroup = "<<aNbGroup<<"\n");
for(TInt iGroup = 0; iGroup < aNbGroup; iGroup++){
aName = anInfo->GetGroupName(iGroup);
INITMSG(MYDEBUG,"aGroupName = '"<<aName<<"'\n");
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();
aIndex0 = aIndex[iElem];
}
ADDMSG(MYDEBUG,endl);
- ADDMSG(MYDEBUG," Indexes :");
+ BEGMSG(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();
}
}
#endif
+
return anInfo;
}
}
ADDMSG(MYDEBUG,endl);
}
-
ADDMSG(MYDEBUG,endl);
#endif
TInt aNbComp = GetNbComp(theId);
PFieldInfo anInfo = CrFieldInfo(theMeshInfo,aNbComp);
GetFieldInfo(theId,*anInfo,theErr);
+
+#ifdef _DEBUG_
+ INITMSG(MYDEBUG,
+ "GetPFieldInfo - aNbComp = "<<aNbComp<<
+ "; aType = "<<anInfo->GetType()<<"\n");
+#endif
+
return anInfo;
}
{
PTimeStampInfo anInfo = CrTimeStampInfo(theFieldInfo,theEntity,theGeom);
GetTimeStampInfo(theId,*anInfo,theErr);
+
+#ifdef _DEBUG_
+ INITMSG(MYDEBUG,
+ "GetPTimeStampInfo - aNbGauss = "<<anInfo->GetNbGauss()<<
+ "; aNumDt = "<<anInfo->GetNumDt()<<"\n");
+#endif
+
return anInfo;
}
{
PTimeStampVal anInfo = CrTimeStampVal(theTimeStampInfo);
GetTimeStampVal(*anInfo,theErr);
+
+#ifdef _DEBUG_
+ TInt aNbGauss = theTimeStampInfo->GetNbGauss();
+ PFieldInfo aFieldInfo = theTimeStampInfo->GetFieldInfo();
+ TInt aNbComp = aFieldInfo->GetNbComp();
+ INITMSG(MYDEBUG,"GetPTimeStampVal\n");
+ TMeshValue& aMeshValue = anInfo->myMeshValue;
+ TMeshValue::const_iterator aMeshValueIter = aMeshValue.begin();
+ for(; aMeshValueIter != aMeshValue.end(); aMeshValueIter++){
+ const EGeometrieElement& aGeom = aMeshValueIter->first;
+ const TValue& aValue = aMeshValueIter->second;
+ TInt iElemEnd = aValue.size() / aNbComp / aNbGauss;
+ INITMSG(MYDEBUG,"aGeom = "<<aGeom<<" - "<<iElemEnd<<": ");
+ for(TInt iElem = 0, anId = 0; iElem < iElemEnd; iElem++){
+ ADDMSG(MYVALUEDEBUG,"{");
+ for(TInt iComp = 0; iComp < aNbComp; iComp++){
+ for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+ ADDMSG(MYVALUEDEBUG,aValue[anId++]<<" ");
+ }
+ ADDMSG(MYVALUEDEBUG,"| ");
+ }
+ ADDMSG(MYVALUEDEBUG,"} ");
+ }
+ ADDMSG(MYDEBUG,"\n");
+ }
+#endif
+
return anInfo;
}
}
static int MYVALUEDEBUG = 0;
-static int MYWRITEDEBUG = 0;
+static int MYWRITEDEBUG = 1;
using namespace MED;
//continue;
- PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
-
TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
TElemGroup aElemGroup = GetElemsByEntity(aMed,aMeshInfo,aEntityInfo);
TFamilyGroup aFamilyGroup = GetFamilies(aMed,aMeshInfo);
- TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aNodeInfo,aElemGroup,aFamilyGroup);
+ TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aElemGroup,aFamilyGroup);
TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup);
TTimeStampGroup aTimeStampGroup = GetFieldsByEntity(aMed,aMeshInfo,aEntityInfo);
TFieldGroup aFieldGroup = GetFieldsByEntity(aTimeStampGroup);
+
+ TFieldGroup::const_iterator aFieldGroupIter = aFieldGroup.begin();
+ for(; aFieldGroupIter != aFieldGroup.end(); aFieldGroupIter++){
+ const TTimeStampGroup& aTTimeStampGroup = aFieldGroupIter->second;
+ TTimeStampGroup::const_iterator aTTimeStampGroupIter = aTTimeStampGroup.begin();
+ for(; aTTimeStampGroupIter != aTTimeStampGroup.end(); aTTimeStampGroupIter++){
+ PFieldInfo aFieldInfo = aTTimeStampGroupIter->first;
+ const TTimeStampSet& aTimeStampSet = aTTimeStampGroupIter->second;
+ TTimeStampSet::const_iterator aTTimeStampSetIter = aTimeStampSet.begin();
+ for(; aTTimeStampSetIter != aTimeStampSet.end(); aTTimeStampSetIter++){
+ PTimeStampInfo aTimeStampInfo = *aTTimeStampSetIter;
+ TErr anErr;
+ PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStampInfo,&anErr);
+ }
+ }
+ }
+
}
}
MSG(MYDEBUG,"OK");
TFileWrapper aFileWrapper(myFile,eLECT,theErr);
if(theErr){
- *theErr &= !theEntityInfo.empty();
- if(!*theErr)
+ if(theEntityInfo.empty())
+ *theErr = -1;
+ if(*theErr < 0)
return -1;
- }
-
- if(theEntityInfo.empty())
+ }else if(theEntityInfo.empty())
EXCEPTION(runtime_error,"GetNbTimeStamps - There is no any Entity on the Mesh");
theGeom.clear();
TGeom& aTGeom = theInfo.myGeom;
if(theErr){
- *theErr &= !aTGeom.empty();
- if(!*theErr)
+ if(aTGeom.empty())
+ *theErr = -1;
+ if(*theErr < 0)
return;
- }
-
- if(aTGeom.empty())
+ }else if(aTGeom.empty())
EXCEPTION(runtime_error,"GetTimeStampInfo - There is no any cell");
MED::TFieldInfo& aFieldInfo = *theInfo.myFieldInfo;
&theInfo.myUnitDt[0],
&theInfo.myDt,
&theInfo.myNumOrd);
+
if(theErr)
*theErr = aRet;
else if(aRet < 0)
EXCEPTION(runtime_error,"GetTimeStampInfo - MEDpasdetempsInfo(...)");
static TInt MAX_NB_GAUSS_POINTS = 32;
- if(theInfo.myNbGauss > MAX_NB_GAUSS_POINTS)
+ if(theInfo.myNbGauss <= 0 || theInfo.myNbGauss > MAX_NB_GAUSS_POINTS)
theInfo.myNbGauss = 1;
}
*theErr = -1;
return;
}
- EXCEPTION(runtime_error,"GetTimeStampInfo - iEnd == "<<iEnd<<" != aValue.size() == "<<aValue.size());
+ EXCEPTION(runtime_error,
+ "GetTimeStampInfo - iEnd("<<iEnd<<
+ ") != aValue.size()("<<aValue.size()<<
+ "); aNbVal = "<<aNbVal<<
+ "; anEntity = "<<anEntity<<
+ "; aGeom = "<<aGeom);
}
TErr aRet;
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
if(theErr){
- *theErr &= !theEntityInfo.empty();
- if(!*theErr)
+ if(theEntityInfo.empty())
+ *theErr = -1;
+ if(*theErr < 0)
return -1;
- }
-
- if(theEntityInfo.empty())
+ }else if(theEntityInfo.empty())
EXCEPTION(runtime_error,"GetNbTimeStamps - There is no any Entity on the Mesh");
theGeom.clear();
TGeom& aTGeom = theInfo.myGeom;
if(theErr){
- *theErr &= !aTGeom.empty();
- if(!*theErr)
+ if(aTGeom.empty())
+ *theErr = -1;
+ if(*theErr < 0)
return;
- }
-
- if(aTGeom.empty())
+ }else if(aTGeom.empty())
EXCEPTION(runtime_error,"GetTimeStampInfo - There is no any cell");
MED::TFieldInfo& aFieldInfo = *theInfo.myFieldInfo;
EXCEPTION(runtime_error,"GetTimeStampInfo - MEDpasdetempsInfo(...)");
static TInt MAX_NB_GAUSS_POINTS = 32;
- if(theInfo.myNbGauss > MAX_NB_GAUSS_POINTS)
+ if(theInfo.myNbGauss <= 0 || theInfo.myNbGauss > MAX_NB_GAUSS_POINTS)
theInfo.myNbGauss = 1;
}
aPflMode);
if(aNbVal <= 0){
if(theErr){
- *theErr = MED_FAUX;
+ *theErr = -1;
return;
}
EXCEPTION(runtime_error,"GetTimeStampInfo - MEDnVal(...) - aNbVal == "<<aNbVal<<" <= 0");
if(iEnd != aValue.size()){
if(theErr){
- *theErr = MED_FAUX;
+ *theErr = -1;
return;
}
- EXCEPTION(runtime_error,"GetTimeStampInfo - iEnd == "<<iEnd<<" != aValue.size() == "<<aValue.size());
+ EXCEPTION(runtime_error,
+ "GetTimeStampInfo - iEnd("<<iEnd<<
+ ") != aValue.size()("<<aValue.size()<<
+ "); aNbVal = "<<aNbVal<<
+ "; anEntity = "<<anEntity<<
+ "; aGeom = "<<aGeom);
}
TErr aRet;
aTimeStampInfo.myNumDt,
aTimeStampInfo.myNumOrd);
if(aRet >= 0)
- for(TInt i = 0; i < iEnd; i++) {
+ for(TInt i = 0; i < iEnd; i++)
aValue[i] = anArray[i];
- ADDMSG(MYDEBUG," "<<anArray[i]);
- }
- ADDMSG(MYDEBUG,endl);
break;
}
default: {