// OCCT Includes
#include <Bnd_Box.hxx>
+#ifdef ENABLE_MULTIPR
// MULTIPR
#include "MULTIPR_Obj.hxx"
+#endif
using namespace VISU;
using namespace std;
_PTR(AttributeString) aCmnt (anAttr);
aCmnt->SetValue(theComment);
}
- // MULTIPR
- if (theIcon != "") {
- anAttr = aStudyBuilder->FindOrCreateAttribute(aNewObj, "AttributePixMap");
+ // MULTIPR
+ if (theIcon != "") {
+ anAttr = aStudyBuilder->FindOrCreateAttribute(aNewObj, "AttributePixMap");
_PTR(AttributePixMap) aPixmap (anAttr);
aPixmap->SetPixMap(theIcon.c_str());
-
- }
+ }
return aNewObj->GetID();
}
"",
true);
}
-
- // MULTIPR
- aMesh->myPartsEntry =
- CreateAttributes(theStudy,
- aMesh->myEntry,
- "",
- "",
- "",
- true);
-
+
+#ifdef ENABLE_MULTIPR
+ // MULTIPR
+ aMesh->myPartsEntry =
+ CreateAttributes(theStudy,
+ aMesh->myEntry,
+ "",
+ "",
+ "",
+ true);
+#endif
+
//Import entities
TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
//---------------------------------------------------------------
-void BuildFields(
+ void BuildFields(
Result_i* theResult,
VISU_Convertor* theInput,
CORBA::Boolean* theIsDone,
CORBA::Boolean theIsBuild,
CORBA::Boolean theIsAtOnce,
_PTR(Study) theStudy)
-{
- if(!theIsBuild || *theIsDone)
- return;
+ {
+ if(!theIsBuild || *theIsDone)
+ return;
- TTimerLog aTimerLog(MYTIMEDEBUG,"Result_i::BuildFields");
- TResultManager aResultManager(theResult);
- TTransactionManager aTransactionManager(theStudy);
+ TTimerLog aTimerLog(MYTIMEDEBUG,"Result_i::BuildFields");
+ TResultManager aResultManager(theResult);
+ TTransactionManager aTransactionManager(theStudy);
- {
- TTimerLog aTimerLog(MYTIMEDEBUG,"theInput->BuildFields");
- theInput->BuildFields();
- }
+ {
+ TTimerLog aTimerLog(MYTIMEDEBUG,"theInput->BuildFields");
+ theInput->BuildFields();
+ }
- QString aComment,aTmp;
- const TMeshMap& aMeshMap = theInput->GetMeshMap();
- TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
+ QString aComment,aTmp;
+ const TMeshMap& aMeshMap = theInput->GetMeshMap();
+ TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
+
+ for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++)
+ {
+ const string& aMeshName = aMeshMapIter->first;
+ const PMesh& aMesh = aMeshMapIter->second;
+
+ const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+ if(aMeshOnEntityMap.empty())
+ continue;
+
+ //Import fields
+ bool anIsFieldsEntryUpdated = false;
+ TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+
+ for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++)
+ {
+ const TEntity& anEntity = aMeshOnEntityMapIter->first;
+ const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+ const TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+ TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
- for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++)
+ for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++)
{
- const string& aMeshName = aMeshMapIter->first;
- const PMesh& aMesh = aMeshMapIter->second;
-
- const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
- if(aMeshOnEntityMap.empty())
- continue;
-
- //Import fields
- bool anIsFieldsEntryUpdated = false;
- TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
-
- for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++)
- {
- const TEntity& anEntity = aMeshOnEntityMapIter->first;
- const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
- const TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
- TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
-
- for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++)
- {
- if(!anIsFieldsEntryUpdated)
- {
- aComment = "";
- aComment.append("myComment=FIELDS;");
- aComment.append("myMeshName=");aComment.append(aMeshName);
-
- UpdateAttributes(
- theStudy,
- aMesh->myFieldsEntry,
- "",
- "Fields",
- aComment.latin1());
-
- anIsFieldsEntryUpdated = true;
- }
-
- const string& aFieldName = aFieldMapIter->first;
- const PField& aField = aFieldMapIter->second;
- const TValField& aValField = aField->myValField;
- QString aFieldNameWithUnit = GenerateFieldName(aFieldName,aField->myUnitNames[0]);
- 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,
- "",
- aFieldNameWithUnit.latin1(),
- aComment.latin1(),
- true);
-
- CreateReference(
- theStudy,
- aField->myEntry,
- aMeshOnEntity->myEntry);
-
- TValField::const_iterator aValFieldIter = aValField.begin();
-
- for(; aValFieldIter != aValField.end(); aValFieldIter++)
- {
- int aTimeStamp = aValFieldIter->first;
- const PValForTime& aValForTime = aValFieldIter->second;
- 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,
- aField->myEntry,
- "",
- aTimeStampId,
- aComment.latin1(),
- true);
- }
- }
- }
-
- if(!anIsFieldsEntryUpdated && !theIsAtOnce)
-
- RemoveSObject(theStudy, aMesh->myFieldsEntry);
+ if(!anIsFieldsEntryUpdated)
+ {
+ aComment = "";
+ aComment.append("myComment=FIELDS;");
+ aComment.append("myMeshName=");aComment.append(aMeshName);
+
+ UpdateAttributes(
+ theStudy,
+ aMesh->myFieldsEntry,
+ "",
+ "Fields",
+ aComment.latin1());
+
+ anIsFieldsEntryUpdated = true;
+ }
+
+ const string& aFieldName = aFieldMapIter->first;
+ const PField& aField = aFieldMapIter->second;
+ const TValField& aValField = aField->myValField;
+ QString aFieldNameWithUnit = GenerateFieldName(aFieldName,aField->myUnitNames[0]);
+ 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,
+ "",
+ aFieldNameWithUnit.latin1(),
+ aComment.latin1(),
+ true);
+
+ CreateReference(
+ theStudy,
+ aField->myEntry,
+ aMeshOnEntity->myEntry);
+
+ TValField::const_iterator aValFieldIter = aValField.begin();
+
+ for(; aValFieldIter != aValField.end(); aValFieldIter++)
+ {
+ int aTimeStamp = aValFieldIter->first;
+ const PValForTime& aValForTime = aValFieldIter->second;
+ 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,
+ aField->myEntry,
+ "",
+ aTimeStampId,
+ aComment.latin1(),
+ true);
+ }
}
+ }
- ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone));
-}
+ if(!anIsFieldsEntryUpdated && !theIsAtOnce)
+ RemoveSObject(theStudy, aMesh->myFieldsEntry);
+ }
+ ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone));
+ }
+
+
+#ifdef ENABLE_MULTIPR
+ // MULTIPR
+ void BuildParts (Result_i* theResult,
+ VISU_Convertor* theInput,
+ CORBA::Boolean* theIsDone,
+ CORBA::Boolean theIsBuild,
+ CORBA::Boolean theIsAtOnce,
+ _PTR(Study) theStudy)
+ {
+ if(!theIsBuild || *theIsDone)
+ return;
+
+ // if MED file is not a distributed MED file (created with MULTIPR),
+ // then it is not necessary to build parts
+ cout<<theResult->GetFileInfoMultipr().filePath()<<endl;
+ if (strlen(theResult->GetFileInfoMultipr().filePath().latin1()) == 0)
+ return;
+
+ QApplication::setOverrideCursor(Qt::waitCursor);
-// MULTIPR
-void BuildParts(
- Result_i* theResult,
- VISU_Convertor* theInput,
- CORBA::Boolean* theIsDone,
- CORBA::Boolean theIsBuild,
- CORBA::Boolean theIsAtOnce,
- _PTR(Study) theStudy)
-{
- if(!theIsBuild || *theIsDone)
- return;
-
- // if MED file is not a distributed MED file (created with MULTIPR), then it is not necessary to build parts
- cout<<theResult->GetFileInfoMultipr().filePath()<<endl;
- if (strlen(theResult->GetFileInfoMultipr().filePath().latin1()) == 0)
- return;
-
- QApplication::setOverrideCursor(Qt::waitCursor);
-
try
{
- multipr::Obj multiprObj;
- multiprObj.create(theResult->GetFileInfoMultipr().filePath().latin1());
- if (multiprObj.isValidDistributedMEDFile())
- {
- theResult->SetIsDistributedMEDMultipr(true);
-
- const TMeshMap& aMeshMap = theInput->GetMeshMap();
- TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
- const string& aMeshName = aMeshMapIter->first;
- const PMesh& aMesh = aMeshMapIter->second;
-
- vector<string> listParts = multiprObj.getParts();
-
- QString aComment = "Sub-parts: #";
- aComment += QString::number(listParts.size());
-
- UpdateAttributes(
+ multipr::Obj multiprObj;
+ multiprObj.create(theResult->GetFileInfoMultipr().filePath().latin1());
+ if (multiprObj.isValidDistributedMEDFile())
+ {
+ theResult->SetIsDistributedMEDMultipr(true);
+
+ const TMeshMap& aMeshMap = theInput->GetMeshMap();
+ TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
+ const string& aMeshName = aMeshMapIter->first;
+ const PMesh& aMesh = aMeshMapIter->second;
+
+ vector<string> listParts = multiprObj.getParts();
+
+ QString aComment = "Sub-parts: #";
+ aComment += QString::number(listParts.size());
+
+ UpdateAttributes(
theStudy,
aMesh->myPartsEntry,
"",
"Parts",
aComment.latin1());
-
- string lastEntry;
-
- for (unsigned i = 0 ; i < listParts.size() ; i++)
- {
- const char* strItem = listParts[i].c_str();
- const char* strPartInfo = multiprObj.getPartInfo(strItem).c_str();
-
- char lMeshName[256];
- int lId;
- char lPartName[256];
- char lPath[256];
- char lMEDFileName[256];
-
- // parse infos
- int ret = sscanf(strPartInfo, "%s %d %s %s %s",
- lMeshName,
- &lId,
- lPartName,
- lPath,
- lMEDFileName);
-
- if ((strstr(lPartName,"_MED") != NULL) || (strstr(lPartName,"_LOW") != NULL))
- {
- QString aComment = "";
- aComment.append("myComment=PART;");
- aComment.append("res=ML;");
- aComment.append("file=");
- aComment.append(lMEDFileName);
-
- CreateAttributes(
- theStudy,
- lastEntry, // father
- "",
- lPartName,
- aComment.latin1(),
- true);
- }
- else
- {
- QString aComment = "";
-
- QString icon = "";
-
- if (i != listParts.size()-1)
- {
- const char* strItemNext = listParts[i+1].c_str();
- const char* strPartInfoNext = multiprObj.getPartInfo(strItemNext).c_str();
- if ((strstr(strPartInfoNext,"_MED") != NULL) || (strstr(strPartInfoNext,"_LOW") != NULL))
- {
- // next part is MED or LOW resolution
- icon = "ICON_MULTIPR_VIEW_LOW";
- theResult->SetResolutionMultipr(lPartName, 'L');
-
- aComment.append("myComment=PART;");
- aComment.append("res=FML;");
- aComment.append("file=");
- aComment.append(lMEDFileName);
- }
- else
- {
- // no resolution associated with this part
- icon = "ICON_MULTIPR_VIEW_FULL";
- theResult->SetResolutionMultipr(lPartName, 'F');
-
- aComment.append("myComment=PART;");
- aComment.append("res=F;");
- aComment.append("file=");
- aComment.append(lMEDFileName);
- }
- }
- else
- {
- // last part
- icon = "ICON_MULTIPR_VIEW_FULL";
- theResult->SetResolutionMultipr(lPartName, 'F');
-
- aComment.append("myComment=PART;");
- aComment.append("res=FML;");
- aComment.append("file=");
- aComment.append(lMEDFileName);
- }
-
- lastEntry = CreateAttributes(
- theStudy,
- aMesh->myPartsEntry, // father
- "",
- lPartName,
- aComment.latin1(),
- true,
- icon.latin1());
- }
-
- theResult->AddPartMultipr(lPartName, lMEDFileName);
- }
- }
- else
- {
- // invalid distributed MED file
- return;
- }
+
+ string lastEntry;
+
+ for (unsigned i = 0 ; i < listParts.size() ; i++)
+ {
+ const char* strItem = listParts[i].c_str();
+ const char* strPartInfo = multiprObj.getPartInfo(strItem).c_str();
+
+ char lMeshName[256];
+ int lId;
+ char lPartName[256];
+ char lPath[256];
+ char lMEDFileName[256];
+
+ // parse infos
+ int ret = sscanf(strPartInfo, "%s %d %s %s %s",
+ lMeshName,
+ &lId,
+ lPartName,
+ lPath,
+ lMEDFileName);
+
+ if ((strstr(lPartName,"_MED") != NULL) || (strstr(lPartName,"_LOW") != NULL))
+ {
+ QString aComment = "";
+ aComment.append("myComment=PART;");
+ aComment.append("res=ML;");
+ aComment.append("file=");
+ aComment.append(lMEDFileName);
+
+ CreateAttributes(
+ theStudy,
+ lastEntry, // father
+ "",
+ lPartName,
+ aComment.latin1(),
+ true);
+ }
+ else
+ {
+ QString aComment = "";
+ QString icon = "";
+
+ if (i != listParts.size()-1)
+ {
+ const char* strItemNext = listParts[i+1].c_str();
+ const char* strPartInfoNext = multiprObj.getPartInfo(strItemNext).c_str();
+ if ((strstr(strPartInfoNext,"_MED") != NULL) || (strstr(strPartInfoNext,"_LOW") != NULL))
+ {
+ // next part is MED or LOW resolution
+ icon = "ICON_MULTIPR_VIEW_LOW";
+ theResult->SetResolutionMultipr(lPartName, 'L');
+
+ aComment.append("myComment=PART;");
+ aComment.append("res=FML;");
+ aComment.append("file=");
+ aComment.append(lMEDFileName);
+ }
+ else
+ {
+ // no resolution associated with this part
+ icon = "ICON_MULTIPR_VIEW_FULL";
+ theResult->SetResolutionMultipr(lPartName, 'F');
+
+ aComment.append("myComment=PART;");
+ aComment.append("res=F;");
+ aComment.append("file=");
+ aComment.append(lMEDFileName);
+ }
+ }
+ else
+ {
+ // last part
+ icon = "ICON_MULTIPR_VIEW_FULL";
+ theResult->SetResolutionMultipr(lPartName, 'F');
+
+ aComment.append("myComment=PART;");
+ aComment.append("res=FML;");
+ aComment.append("file=");
+ aComment.append(lMEDFileName);
+ }
+
+ lastEntry = CreateAttributes(
+ theStudy,
+ aMesh->myPartsEntry, // father
+ "",
+ lPartName,
+ aComment.latin1(),
+ true,
+ icon.latin1());
+ }
+
+ theResult->AddPartMultipr(lPartName, lMEDFileName);
+ }
+ }
+ else
+ {
+ // invalid distributed MED file
+ return;
+ }
}
catch (...)
{
- throw std::runtime_error("error while reading distributed MED file");
+ throw std::runtime_error("error while reading distributed MED file");
}
-
- QApplication::restoreOverrideCursor();
- ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone));
-}
+ QApplication::restoreOverrideCursor();
+
+ ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone));
+ }
+#endif
//---------------------------------------------------------------
theIsBuildMinMax,
theUpdateMinMaxSignal);
}
-
+
//---------------------------------------------------------------
struct TBuildArgs
Result_i::TUpdateMinMaxSignal* myUpdateMinMaxSignal;
CORBA::Boolean* myIsGroupsDone;
CORBA::Boolean myIsBuildGroups;
+#ifdef ENABLE_MULTIPR
CORBA::Boolean* myIsPartsDone;
CORBA::Boolean myIsBuildParts;
- _PTR(Study) myStudy;
+#endif
+ _PTR(Study) myStudy;
TBuildArgs(Result_i* theResult,
VISU_Convertor* theInput,
Result_i::TUpdateMinMaxSignal* theUpdateMinMaxSignal,
CORBA::Boolean* theIsGroupsDone,
CORBA::Boolean theIsBuildGroups,
+#ifdef ENABLE_MULTIPR
CORBA::Boolean* theIsPartsDone,
CORBA::Boolean theIsBuildParts,
- _PTR(Study) theStudy):
+#endif
+ _PTR(Study) theStudy):
myResult(theResult),
myInput(theInput),
myIsEntitiesDone(theIsEntitiesDone),
myUpdateMinMaxSignal(theUpdateMinMaxSignal),
myIsGroupsDone(theIsGroupsDone),
myIsBuildGroups(theIsBuildGroups),
+#ifdef ENABLE_MULTIPR
myIsPartsDone(theIsPartsDone),
myIsBuildParts(theIsBuildParts),
- myStudy(theStudy)
+#endif
+ myStudy(theStudy)
{}
-
};
//---------------------------------------------------------------
void
BuildDataTree(TBuildArgs theBuildArgs)
{
-
BuildEntities(theBuildArgs.myResult,
theBuildArgs.myInput,
theBuildArgs.myIsEntitiesDone,
theBuildArgs.myIsBuildGroups,
theBuildArgs.myIsBuildFields,
theBuildArgs.myStudy);
-
- {
+
+ {
boost::thread aThread(boost::bind(&BuildGroups,
theBuildArgs.myResult,
theBuildArgs.myInput,
theBuildArgs.myUpdateMinMaxSignal,
theBuildArgs.myStudy));
}
-
- /*
- // MULTIPR
- BuildParts(
- theBuildArgs.myResult,
- theBuildArgs.myInput,
- theBuildArgs.myIsPartsDone,
- theBuildArgs.myIsBuildParts,
- false,
- theBuildArgs.myStudy);
- */
+
+ /*
+ // MULTIPR
+ BuildParts(theBuildArgs.myResult,
+ theBuildArgs.myInput,
+ theBuildArgs.myIsPartsDone,
+ theBuildArgs.myIsBuildParts,
+ false,
+ theBuildArgs.myStudy);
+ */
}
-
}
myIsBuildFields(theIsBuildFields),
myIsBuildMinMax(theIsBuildMinMax),
myIsBuildGroups(theIsBuildGroups),
+#ifdef ENABLE_MULTIPR
myIsBuildParts(true),
+#endif
myIsEntitiesDone(false),
myIsFieldsDone(false),
myIsGroupsDone(false),
myIsMinMaxDone(false),
+#ifdef ENABLE_MULTIPR
myIsPartsDone(false),
+#endif
myIsAllDone(false),
myInput(NULL)
{
myStudy = ProcessEvent(new TGetStudy(myStudyDocument->StudyId()));
+#ifdef ENABLE_MULTIPR
myIsDistributedMEDMultipr = false;
+#endif
}
&myIsMinMaxDone,
myIsBuildMinMax,
&myUpdateMinMaxSignal);
-
- // MULTIPR
- BuildParts(this,
- myInput,
- &myIsPartsDone,
- myIsBuildParts,
- theIsAtOnce,
- myStudy);
-
- }else{
-
- if (strlen(GetFileInfoMultipr().filePath().latin1()) == 0)
- {
- // sequential MED file
- TBuildArgs aBuildArgs(this,
- myInput,
- &myIsEntitiesDone,
- aResultEntry,
- &myIsFieldsDone,
- myIsBuildFields,
- &myIsMinMaxDone,
- myIsBuildMinMax,
- &myUpdateMinMaxSignal,
- &myIsGroupsDone,
- myIsBuildGroups,
- &myIsPartsDone,
- myIsBuildParts,
- myStudy);
- boost::thread aThread(boost::bind(&BuildDataTree, aBuildArgs));
- }
- else
- {
- // distributed MED file
- BuildEntities(this,
- myInput,
- &myIsEntitiesDone,
- aResultEntry,
- theIsAtOnce,
- myIsBuildGroups,
- myIsBuildFields,
- myStudy);
-
- BuildGroups(this,
- myInput,
- &myIsGroupsDone,
- myIsBuildGroups,
- theIsAtOnce,
- myStudy);
-
- BuildFields(this,
- myInput,
- &myIsFieldsDone,
- myIsBuildFields,
- theIsAtOnce,
- myStudy);
-
- BuildMinMax(this,
- myInput,
- &myIsMinMaxDone,
- myIsBuildMinMax,
- &myUpdateMinMaxSignal);
-
- // MULTIPR
- BuildParts(this,
- myInput,
- &myIsPartsDone,
- myIsBuildParts,
- theIsAtOnce,
- myStudy);
- }
+
+#ifdef ENABLE_MULTIPR
+ // MULTIPR
+ BuildParts(this,
+ myInput,
+ &myIsPartsDone,
+ myIsBuildParts,
+ theIsAtOnce,
+ myStudy);
+#endif
+ }
+ else {
+#ifdef ENABLE_MULTIPR
+ if (strlen(GetFileInfoMultipr().filePath().latin1()) == 0)
+#endif
+ {
+ // sequential MED file
+ TBuildArgs aBuildArgs(this,
+ myInput,
+ &myIsEntitiesDone,
+ aResultEntry,
+ &myIsFieldsDone,
+ myIsBuildFields,
+ &myIsMinMaxDone,
+ myIsBuildMinMax,
+ &myUpdateMinMaxSignal,
+ &myIsGroupsDone,
+ myIsBuildGroups,
+#ifdef ENABLE_MULTIPR
+ &myIsPartsDone,
+ myIsBuildParts,
+#endif
+ myStudy);
+ boost::thread aThread(boost::bind(&BuildDataTree, aBuildArgs));
+ }
+#ifdef ENABLE_MULTIPR
+ else
+ {
+ // distributed MED file
+ BuildEntities(this,
+ myInput,
+ &myIsEntitiesDone,
+ aResultEntry,
+ theIsAtOnce,
+ myIsBuildGroups,
+ myIsBuildFields,
+ myStudy);
+
+ BuildGroups(this,
+ myInput,
+ &myIsGroupsDone,
+ myIsBuildGroups,
+ theIsAtOnce,
+ myStudy);
+
+ BuildFields(this,
+ myInput,
+ &myIsFieldsDone,
+ myIsBuildFields,
+ theIsAtOnce,
+ myStudy);
+
+ BuildMinMax(this,
+ myInput,
+ &myIsMinMaxDone,
+ myIsBuildMinMax,
+ &myUpdateMinMaxSignal);
+
+ // MULTIPR
+ BuildParts(this,
+ myInput,
+ &myIsPartsDone,
+ myIsBuildParts,
+ theIsAtOnce,
+ myStudy);
+ }
+#endif
}
return this;
VISU::Result_i::
Create(const char* theFileName)
{
-
- try{
+ try {
myFileInfo.setFile(theFileName);
-
- // MULTIPR
- if (myFileInfo.filePath().endsWith("_grains_maitre.med"))
- {
- // retrieve source MED file (sequential MED file)
- QString originalMEDFileName = "";
- FILE* aFile = fopen(theFileName, "rt");
- char aBuf[1024];
- while (!feof(aFile))
- {
- fgets(aBuf, 1024, aFile);
- char* strTag = NULL;
- if ((aBuf[0] == '#') && ((strTag = strstr(aBuf, "[SOURCE]=")) != NULL))
- {
- char strSequentialMEDFilename[256];
- int ret = sscanf(strTag, "[SOURCE]=%s", strSequentialMEDFilename);
- if (ret == 1)
- {
- originalMEDFileName = strSequentialMEDFilename;
- break;
- }
- }
- }
- fclose(aFile);
- if (originalMEDFileName == "")
- throw std::runtime_error("distributed MED file; bad format");
-
- //cout << "MULTIPR: original med file=" << originalMEDFileName << endl;
- myFileInfoMultipr.setFile(myFileInfo.filePath());
- myFileInfo.setFile(originalMEDFileName);
- }
- else
+
+#ifdef ENABLE_MULTIPR
+ // MULTIPR
+ if (myFileInfo.filePath().endsWith("_grains_maitre.med"))
+ {
+ // retrieve source MED file (sequential MED file)
+ QString originalMEDFileName = "";
+ FILE* aFile = fopen(theFileName, "rt");
+ char aBuf[1024];
+ while (!feof(aFile))
+ {
+ fgets(aBuf, 1024, aFile);
+ char* strTag = NULL;
+ if ((aBuf[0] == '#') && ((strTag = strstr(aBuf, "[SOURCE]=")) != NULL))
{
- myFileInfoMultipr.setFile("");
+ char strSequentialMEDFilename[256];
+ int ret = sscanf(strTag, "[SOURCE]=%s", strSequentialMEDFilename);
+ if (ret == 1)
+ {
+ originalMEDFileName = strSequentialMEDFilename;
+ break;
+ }
}
-
+ }
+ fclose(aFile);
+ if (originalMEDFileName == "")
+ throw std::runtime_error("distributed MED file; bad format");
+
+ //cout << "MULTIPR: original med file=" << originalMEDFileName << endl;
+ myFileInfoMultipr.setFile(myFileInfo.filePath());
+ myFileInfo.setFile(originalMEDFileName);
+ }
+ else
+ {
+ myFileInfoMultipr.setFile("");
+ }
+#endif
+
myInitFileName = myFileInfo.filePath().latin1();
myName = ::GenerateName(myFileInfo.fileName()).latin1();
if(mySourceId == eRestoredFile){
if(MYDEBUG) MESSAGE("Result_i::Create - aCommand = "<<aCommand);
myFileInfo.setFile(QString(aTmpDir.c_str()) + myFileInfo.fileName());
}
-
+
myInput = CreateConvertor(myFileInfo.absFilePath().latin1());
-
+
if(myInput){
if(myIsBuildImmediately)
Build(SALOMEDS::SObject::_nil());
}
+#ifdef ENABLE_MULTIPR
//=======================================================================
// MULTIPR
//=======================================================================
// MULTIPR
void VISU::Result_i::AddPartMultipr(const char* thePartName, const char* theMEDFilename)
{
- myMapPartNameToMEDFilename.insert(make_pair(thePartName, theMEDFilename));
+ myMapPartNameToMEDFilename.insert(make_pair(thePartName, theMEDFilename));
}
// MULTIPR
void VISU::Result_i::SetResolutionMultipr(const char* theName, char theNewResolution)
{
- map<string, char>::iterator anIterator = mySelectedResolutionMultipr.find(theName);
-
- if (anIterator == mySelectedResolutionMultipr.end())
- {
- // current name does not exist: create
- mySelectedResolutionMultipr.insert(make_pair(theName, theNewResolution));
- }
- else
- {
- // modify
- (*anIterator).second = theNewResolution;
- }
+ map<string, char>::iterator anIterator = mySelectedResolutionMultipr.find(theName);
+
+ if (anIterator == mySelectedResolutionMultipr.end())
+ {
+ // current name does not exist: create
+ mySelectedResolutionMultipr.insert(make_pair(theName, theNewResolution));
+ }
+ else
+ {
+ // modify
+ (*anIterator).second = theNewResolution;
+ }
}
// MULTIPR
string VISU::Result_i::FindPartMultipr(const char* theName)
{
- map<string, string>::iterator anIterator = myMapPartNameToMEDFilename.find(theName);
-
- if (anIterator == myMapPartNameToMEDFilename.end())
- {
- return NULL;
- }
- return (*anIterator).second;
+ map<string, string>::iterator anIterator = myMapPartNameToMEDFilename.find(theName);
+
+ if (anIterator == myMapPartNameToMEDFilename.end())
+ {
+ return NULL;
+ }
+ return (*anIterator).second;
}
// MULTIPR
void VISU::Result_i::SetIsDistributedMEDMultipr(bool theIsDistributedMED)
{
- myIsDistributedMEDMultipr = theIsDistributedMED;
+ myIsDistributedMEDMultipr = theIsDistributedMED;
}
// MULTIPR
bool VISU::Result_i::IsDistributedMEDMultipr() const
{
- return myIsDistributedMEDMultipr;
+ return myIsDistributedMEDMultipr;
}
// MULTIPR
vector<string> VISU::Result_i::GetCurrentRepresentationMultipr()
{
- // name of selected parts
- vector<string> res;
-
- // for each part of the mesh
- for (
- map<string, char>::iterator it = mySelectedResolutionMultipr.begin() ;
- it != mySelectedResolutionMultipr.end() ;
- it++)
- {
- const char* partName = ((*it).first).c_str();
- char resolution = (*it).second;
-
- //cout << "name=" << partName << " res=" << resolution << endl;
-
- if (resolution == 'F')
- {
- res.push_back( FindPartMultipr(partName) );
- }
- else if (resolution == 'M')
- {
- char subPartName[256];
- sprintf(subPartName, "%s_MED", partName);
- res.push_back( FindPartMultipr(subPartName) );
- }
- else if (resolution == 'L')
- {
- char subPartName[256];
- sprintf(subPartName, "%s_LOW", partName);
- res.push_back( FindPartMultipr(subPartName) );
- }
- }
-
- return res;
-}
+ // name of selected parts
+ vector<string> res;
+
+ // for each part of the mesh
+ for (map<string, char>::iterator it = mySelectedResolutionMultipr.begin() ;
+ it != mySelectedResolutionMultipr.end() ;
+ it++)
+ {
+ const char* partName = ((*it).first).c_str();
+ char resolution = (*it).second;
+
+ //cout << "name=" << partName << " res=" << resolution << endl;
+
+ if (resolution == 'F')
+ {
+ res.push_back( FindPartMultipr(partName) );
+ }
+ else if (resolution == 'M')
+ {
+ char subPartName[256];
+ sprintf(subPartName, "%s_MED", partName);
+ res.push_back( FindPartMultipr(subPartName) );
+ }
+ else if (resolution == 'L')
+ {
+ char subPartName[256];
+ sprintf(subPartName, "%s_LOW", partName);
+ res.push_back( FindPartMultipr(subPartName) );
+ }
+ }
+ return res;
+}
+#endif // ENABLE_MULTIPR