1 // VISU OBJECT : interactive object for VISU entities implementation
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : VISU_Result_i.cc
24 // Author : Alexey PETROV
27 #include "VISU_MultiResult_i.hh"
28 #include "VISU_ResultUtils.hh"
29 #include "VISU_Prs3d_i.hh"
31 #include "VISU_Convertor_impl.hxx"
32 #include "VISU_CorbaMedConvertor.hxx"
33 #include "VISU_ConvertorUtils.hxx"
34 #include "VISU_PipeLine.hxx"
36 #include "SUIT_ResourceMgr.h"
38 #include "SALOMEDS_Tool.hxx"
39 #include "HDFascii.hxx"
41 #include "SUIT_Session.h"
42 #include "SALOME_Event.hxx"
43 #include "SalomeApp_Study.h"
44 #include "SalomeApp_Application.h"
46 #include <boost/thread/thread.hpp>
47 #include <boost/bind.hpp>
51 #include <qfileinfo.h>
52 #include <qsemaphore.h>
58 #include <vtkUnstructuredGrid.h>
61 #include <Bnd_Box.hxx>
64 static int MYDEBUG = 0;
66 static int MYDEBUG = 0;
72 //---------------------------------------------------------------
74 FindResult(SALOMEDS::SObject_ptr theSObject)
76 SALOMEDS::SComponent_var aSComponent = theSObject->GetFatherComponent();
77 SALOMEDS::SObject_var aFather = theSObject->GetFather();
78 CORBA::String_var aComponentID (aSComponent->GetID());
79 CORBA::String_var aFatherID (aFather->GetID());
81 while (strcmp(aComponentID, aFatherID) != 0) {
82 CORBA::Object_var anObject = SObjectToObject(aFather);
83 if (!CORBA::is_nil(anObject)) {
84 aResult = Result::_narrow(anObject);
85 if (!aResult->_is_nil()) return aResult;
87 aFather = aFather->GetFather();
88 aFatherID = aFather->GetID();
94 //---------------------------------------------------------------
96 GetResult(SALOMEDS::Study_ptr theStudy,
97 const std::string& theResultEntry)
99 if(CORBA::is_nil(theStudy))
102 SALOMEDS::SObject_var aSObject = theStudy->FindObjectID(theResultEntry.c_str());
103 CORBA::Object_var anObject = SObjectToObject(aSObject);
104 return dynamic_cast<VISU::Result_i*>(GetServant(anObject).in());
108 //---------------------------------------------------------------
110 GetComponentDataType (SALOMEDS::SObject_ptr theSObject)
112 SALOMEDS::SComponent_var aCompRefSObj = theSObject->GetFatherComponent();
113 CORBA::String_var aDataType = aCompRefSObj->ComponentDataType();
114 return aDataType.in();
118 //---------------------------------------------------------------
120 CreateReference (SALOMEDS::Study_ptr theStudyDocument,
121 const string& theFatherEntry,
122 const string& theRefEntry)
124 SALOMEDS::StudyBuilder_var aStudyBuilder = theStudyDocument->NewBuilder();
125 SALOMEDS::SObject_var aFather = theStudyDocument->FindObjectID(theFatherEntry.c_str());
126 SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(aFather);
127 SALOMEDS::SObject_var aRefSObj = theStudyDocument->FindObjectID(theRefEntry.c_str());
128 aStudyBuilder->Addreference(newObj,aRefSObj);
132 //---------------------------------------------------------------
136 //---------------------------------------------------------------
137 const string VISU::Result_i::myComment = "RESULT";
138 const char* VISU::Result_i::GetComment() const { return myComment.c_str();}
140 //---------------------------------------------------------------
142 ::Result_i(SALOMEDS::Study_ptr theStudy,
143 const ESourceId& theSourceId,
144 const ECreationId& theCreationId,
145 CORBA::Boolean theIsBuildImmediately,
146 CORBA::Boolean theIsBuildFields,
147 CORBA::Boolean theIsBuildMinMax,
148 CORBA::Boolean theIsBuildGroups):
149 myStudyDocument(SALOMEDS::Study::_duplicate(theStudy)),
150 myCreationId(theCreationId),
151 mySourceId(theSourceId),
152 myIsBuildImmediately(theIsBuildImmediately),
153 myIsBuildFields(theIsBuildFields),
154 myIsBuildMinMax(theIsBuildMinMax),
155 myIsBuildGroups(theIsBuildGroups),
156 myIsEntitiesDone(false),
157 myIsFieldsDone(false),
158 myIsGroupsDone(false),
159 myIsMinMaxDone(false),
161 myIsBuildParts(false),
164 myStudy = VISU::GetStudy(myStudyDocument);
168 //---------------------------------------------------------------
171 myIsEntitiesDone(false),
172 myIsFieldsDone(false),
173 myIsGroupsDone(false),
174 myIsMinMaxDone(false),
176 myIsBuildParts(false),
181 //---------------------------------------------------------------
185 MESSAGE("Result_i::~Result_i() - this = "<<this);
186 if (GetSourceId() == eRestoredFile)
187 VISU::RemoveFile(myFileInfo.filePath().latin1());
191 //---------------------------------------------------------------
196 struct TRemoveFromStudy: public SALOME_Event
198 VISU::Result_i* myRemovable;
199 TRemoveFromStudy(VISU::Result_i* theRemovable):
200 myRemovable(theRemovable)
207 VISU::RemoveFromStudy(myRemovable->GetSObject(),false);
208 myRemovable->Destroy();
212 // Remove the result with all presentations and other possible sub-objects
213 ProcessVoidEvent(new TRemoveFromStudy(this));
217 //---------------------------------------------------------------
220 ::ConnectObserver(TResultObserver* theObserver,
221 boost::signalslib::connection& theConnection)
223 if(theConnection.connected())
224 theConnection.disconnect();
227 myUpdateObserverSignal.connect(boost::bind(boost::bind(&TResultObserver::UpdateFromResult,
234 //---------------------------------------------------------------
239 struct TEvent: public SALOME_Event
241 VISU::Result_i::TUpdateObserverSignal& myUpdateObserverSignal;
243 TEvent(VISU::Result_i::TUpdateObserverSignal& theUpdateObserverSignal):
244 myUpdateObserverSignal(theUpdateObserverSignal)
251 myUpdateObserverSignal();
255 ProcessVoidEvent(new TEvent(myUpdateObserverSignal));
259 //---------------------------------------------------------------
265 size_t aSize = myInput->GetSize();
266 size_t aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
267 MESSAGE("Result_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<float(aResult));
269 }catch(std::exception& exc){
270 INFOS("Follow exception was occured :\n"<<exc.what());
272 INFOS("Unknown exception was occured!");
278 //---------------------------------------------------------------
283 if(MYDEBUG) MESSAGE("Result_i::Build - myIsAllDone = "<<myIsAllDone);
289 const VISU::TMeshMap& aMeshMap = myInput->GetMeshMap();
290 VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
291 for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
292 const string& aMeshName = aMeshMapIter->first;
293 const VISU::PMesh aMesh = aMeshMapIter->second;
294 const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
295 VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
297 aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
298 for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
299 const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
300 const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
301 const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
302 VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
303 for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
304 const string& aFieldName = aFieldMapIter->first;
305 const VISU::PField aField = aFieldMapIter->second;
306 const VISU::TValField& aValField = aField->myValField;
307 VISU::TValField::const_iterator aValFieldIter = aValField.begin();
308 for(; aValFieldIter != aValField.end(); aValFieldIter++){
309 int aTimeStamp = aValFieldIter->first;
311 myInput->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
312 }catch(std::exception& exc){
313 INFOS("Follow exception was occured :\n"<<exc.what());
315 INFOS("Unknown exception was occured!!!");
320 const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
321 VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
322 for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
323 const string& aGroupName = aGroupMapIter->first;
325 myInput->GetMeshOnGroup(aMeshName,aGroupName);
326 }catch(std::exception& exc){
327 INFOS("Follow exception was occured :\n"<<exc.what());
329 INFOS("Unknown exception was occured!!!");
333 const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
334 VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
335 for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
336 const string& aFamilyName = aFamilyMapIter->first;
338 myInput->GetFamilyOnEntity(aMeshName,anEntity,aFamilyName);
339 }catch(std::exception& exc){
340 INFOS("Follow exception was occured :\n"<<exc.what());
342 INFOS("Unknown exception was occured!!!");
345 //Import mesh on entity
347 myInput->GetMeshOnEntity(aMeshName,anEntity);
348 }catch(std::exception& exc){
349 INFOS("Follow exception was occured :\n"<<exc.what());
351 INFOS("Unknown exception was occured!!!");
356 }catch(std::exception& exc){
357 INFOS("Follow exception was occured :\n"<<exc.what());
359 INFOS("Unknown exception was occured!!!");
365 //---------------------------------------------------------------
368 ::Build(CORBA::Boolean theIsBuildAll,
369 CORBA::Boolean theIsAtOnce)
374 if(Build(SALOMEDS::SObject::_nil(), theIsAtOnce)){
377 SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
379 SALOMEDS::GenericAttribute_var anAttr;
380 SALOMEDS::AttributePixMap_var aPixmap;
382 anAttr = aStudyBuilder->FindOrCreateAttribute( mySObject, "AttributePixMap" );
383 aPixmap = SALOMEDS::AttributePixMap::_narrow( anAttr );
384 aPixmap ->SetPixMap("ICON_TREE_RESULT");
395 //---------------------------------------------------------------
396 VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject,
397 CORBA::Boolean theIsAtOnce)
405 mySComponent = FindOrCreateVisuComponent(myStudyDocument);
406 CORBA::String_var aSComponentEntry = mySComponent->GetID();
407 CORBA::String_var anIOR(GetID());
409 aComment.sprintf("myComment=%s;myFileName=%s;myInitFileName=%s",
411 myFileInfo.filePath().latin1(),
412 GetInitFileName().c_str()); // Restoring of Python dump
413 std::string aResultEntry =
414 CreateAttributes(myStudy,
415 aSComponentEntry.in(),
422 mySObject = myStudyDocument->FindObjectID(aResultEntry.c_str());
423 if(!CORBA::is_nil(theSObject)){
424 CORBA::String_var aString = theSObject->GetID();
425 CreateReference(myStudyDocument, aResultEntry, aString.in());
446 BuildFieldDataTree(this,
454 boost::thread aThread(boost::bind(boost::bind(&Result_i::BuildDataTree, this, _1),
462 //---------------------------------------------------------------
465 ::BuildDataTree(const std::string& theResultEntry)
478 boost::thread aThread(boost::bind(&BuildGroups,
487 boost::thread aThread(boost::bind(&BuildFieldDataTree,
498 //---------------------------------------------------------------
501 ::BuildAll(SALOMEDS::SObject_ptr theSObject)
503 if(MYDEBUG) MESSAGE("Result_i::Build");
507 }catch(std::exception& exc){
508 INFOS("Follow exception was occured :\n"<<exc.what());
511 INFOS("Unknown exception was occured!!!");
519 //---------------------------------------------------------------
522 ::Create(const char* theFileName)
525 myFileInfo.setFile(theFileName);
526 myFileName = myFileInfo.fileName().latin1();
529 SetInitFileName(myFileInfo.filePath().latin1());
530 SetName(VISU::GenerateName(myFileInfo.fileName()).latin1(), false);
533 if(mySourceId == eRestoredFile){
534 QString aTmpDir(SALOMEDS_Tool::GetTmpDir().c_str());
535 std::string aFileName = VISU::MakeFileName(myFileInfo.fileName().latin1(), this);
536 QString aPathToCopy(aTmpDir + aFileName.c_str());
537 if(!VISU::CopyFile(myFileInfo.absFilePath().latin1(), aPathToCopy.latin1()))
540 myFileInfo.setFile(aPathToCopy);
541 myFileName = myFileInfo.fileName().latin1();
544 myInput.reset(CreateConvertor(myFileInfo.absFilePath().latin1()));
547 if(myIsBuildImmediately)
548 Build(SALOMEDS::SObject::_nil());
551 }catch(std::exception& exc){
552 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
554 MSG(MYDEBUG,"Unknown exception !!!");
560 //---------------------------------------------------------------
563 ::Create(SALOMEDS::SObject_ptr theMedSObject)
565 if(MYDEBUG) MESSAGE("Result_i::Create MedObject from SALOMEDS::SObject_ptr");
567 myInput.reset(CreateMEDConvertor(theMedSObject));
573 string aCompDataType = GetComponentDataType(theMedSObject);
574 myFileInfo.setFile(aCompDataType.c_str());
575 myFileName = VISU::GenerateName("aResult").latin1();
577 SetInitFileName(aCompDataType);
578 SetName(VISU::GenerateName(myFileInfo.fileName()).latin1(), false);
580 return Build(theMedSObject);
581 }catch(std::exception& exc){
582 INFOS("Follow exception was occured :\n"<<exc.what());
584 INFOS("Unknown exception was occured!!!");
590 //---------------------------------------------------------------
593 ::Create(SALOME_MED::FIELD_ptr theField)
595 if(MYDEBUG) MESSAGE("Result_i::Create MedObject from SALOME_MED::FIELD_ptr");
597 myInput.reset(CreateMEDFieldConvertor(theField));
603 string aCompDataType = "MED";
604 myFileInfo.setFile(aCompDataType.c_str());
606 myFileName = VISU::GenerateName("aResult").latin1();
607 SetInitFileName(aCompDataType);
608 SetName(VISU::GenerateName(myFileInfo.fileName()).latin1(), false);
610 CORBA::String_var anIOR = myStudyDocument->ConvertObjectToIOR(theField);
611 SALOMEDS::SObject_var aFieldSObject = myStudyDocument->FindObjectIOR(anIOR);
613 return Build(aFieldSObject);
614 }catch(std::exception& exc){
615 INFOS("Follow exception was occured :\n"<<exc.what());
617 INFOS("Unknown exception was occured!!!");
623 //---------------------------------------------------------------
626 ::Save(SALOMEDS::SComponent_ptr theComponent,
627 const std::string& theURL,
630 TFileNames& theFileNames,
631 TFileNames& theFiles)
633 switch(GetCreationId()){
634 case Result_i::eImportFile:
635 case Result_i::eCopyAndImportFile: {
636 INITMSG(MYDEBUG, "Result::Save - this = "<<this<<"\n");
637 INITMSGA(MYDEBUG, 0, "theIsMultiFile = "<<theIsMultiFile<<"; theIsASCII = "<<theIsASCII<<"\n");
640 if (theIsMultiFile) {
641 CORBA::String_var anURL = GetStudyDocument()->URL();
642 aPrefix = SALOMEDS_Tool::GetNameFromPath(anURL.in());
645 std::string aFileName = aPrefix + "_" + GetFileName();
646 BEGMSG(MYDEBUG, "aFileName = '"<<aFileName<<"'\n");
648 std::string aFile = GetFileInfo().filePath().latin1();
649 BEGMSG(MYDEBUG, "aFile = '"<<aFile<<"'\n");
651 if(theIsMultiFile || theIsASCII){
652 std::string aPathToCopy(theURL + aFileName);
653 BEGMSG(MYDEBUG, "aPathToCopy = '"<<aPathToCopy<<"'\n");
655 if(!VISU::CopyFile(aFile, aPathToCopy))
659 HDFascii::ConvertFromHDFToASCII(const_cast<char*>(aPathToCopy.c_str()), true);
662 theFileNames.push_back(aFileName);
663 theFiles.push_back(aFile);
672 //---------------------------------------------------------------
675 ::CanCopy(SALOMEDS::SObject_ptr theObject)
677 switch(GetCreationId()){
678 case Result_i::eImportFile:
679 case Result_i::eCopyAndImportFile:
687 //---------------------------------------------------------------
690 ::CopyFrom(SALOMEDS::SObject_ptr theObject,
691 CORBA::Long& theObjectID,
692 const std::string& theTmpDir,
693 TFileNames& theFileNames)
695 if(!Storable::CopyFrom(theObject, theObjectID, theTmpDir, theFileNames))
698 SALOMEDS::Study_var aStudy = theObject->GetStudy();
699 CORBA::String_var anURL = aStudy->URL();
700 std::string aPrefix = SALOMEDS_Tool::GetNameFromPath(anURL.in());
701 std::string aFileName = aPrefix + GetFileInfo().fileName().latin1();
703 static QString aCommand;
704 std::string aFilePath = theTmpDir + aFileName;
705 aCommand.sprintf(" %s %s", GetFileInfo().filePath().latin1(), aFilePath.c_str());
706 aCommand = QDir::convertSeparators( aCommand );
707 aCommand.prepend( COPY_COMMAND );
709 if(system(aCommand.latin1()) != 0) {
710 if(MYDEBUG) MESSAGE("VISU_Gen_i::Copy - Cann't execute the command :"<<aCommand);
714 SALOMEDS::SComponent_var aSComponent = aStudy->FindComponent("VISU");
716 theFileNames.push_back(aFileName);
722 //---------------------------------------------------------------
725 ::Restore(SALOMEDS::SObject_ptr theSObject,
726 const Storable::TRestoringMap& theMap,
727 const string& thePrefix,
728 CORBA::Boolean theIsMultiFile)
730 if(MYDEBUG) MESSAGE("Result_i::Restore - " << thePrefix);
731 mySObject = SALOMEDS::SObject::_duplicate(theSObject);
732 mySComponent = mySObject->GetFatherComponent();
733 myStudyDocument = theSObject->GetStudy();
734 myStudy = VISU::GetStudy(myStudyDocument);
736 myCreationId = ECreationId(Storable::FindValue(theMap, "myCreationId").toInt());
737 mySourceId = eRestoredFile;
738 if(myCreationId == eImportMed || myCreationId == eImportMedField)
739 mySourceId = eRestoredComponent;
741 myIsBuildFields = Storable::FindValue(theMap, "myIsBuildFields", "1").toInt();
742 myIsBuildMinMax = Storable::FindValue(theMap, "myIsBuildMinMax", "1").toInt();
743 myIsBuildGroups = Storable::FindValue(theMap, "myIsBuildGroups", "1").toInt();
745 myIsBuildImmediately = true;
748 myFileName = VISU::Storable::FindValue(theMap, "myName").latin1();
749 SetInitFileName(VISU::Storable::FindValue(theMap, "myInitFileName").latin1());
751 SALOMEDS::SObject_var aRefSObj, aTargetRefSObj;
752 if (theSObject->FindSubObject(1, aRefSObj) && aRefSObj->ReferencedObject(aTargetRefSObj)) {
753 if(MYDEBUG) MESSAGE("Result_i::GetInput - There is some reference.");
754 SALOMEDS::SComponent_var aCompRefSObj = aTargetRefSObj->GetFatherComponent();
755 CORBA::String_var aDataType = aCompRefSObj->ComponentDataType();
756 myFileInfo.setFile(aDataType.in());
757 if(MYDEBUG) MESSAGE("Result_i::GetInput - aDataType = " << aDataType);
758 Engines::Component_var aEngComp =
759 Base_i::myEnginesLifeCycle->FindOrLoad_Component("FactoryServer", aDataType.in());
760 if (CORBA::is_nil(aEngComp))
761 throw std::runtime_error("Restore - There is no aEngComp for the aDataType !!!");
762 SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
763 SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(aEngComp);
764 aStudyBuilder->LoadWith(aCompRefSObj, aDriver);
765 // create field or MED converter
766 CORBA::Object_var aMedObject = VISU::SObjectToObject(aTargetRefSObj);
767 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(aMedObject);
768 if (!CORBA::is_nil(aField)) {
769 // create field converter
770 myInput.reset(CreateMEDFieldConvertor(aField));
773 else if (strcmp(aDataType, "MED") == 0) {
774 // create MED converter
775 myInput.reset(CreateMEDConvertor(aTargetRefSObj));
779 throw std::runtime_error("GetInput - There is no convertor for the aDataType !!!");
782 myFileInfo.setFile(thePrefix.c_str());
784 std::string aStudyPrefix ("");
785 if (theIsMultiFile) {
786 CORBA::String_var anURL(GetStudyDocument()->URL());
787 aStudyPrefix = SALOMEDS_Tool::GetNameFromPath(anURL.in());
789 if (!myFileInfo.isFile()) {
790 std::string aFileName = thePrefix + aStudyPrefix + "_" + myFileName;
791 myFileInfo.setFile(aFileName.c_str());
794 MESSAGE("Result_i::Restore - aFileName = " << myFileInfo.filePath() << "; " << myFileInfo.isFile());
796 const char* aPathLatin = myFileInfo.filePath().latin1();
797 if (HDFascii::isASCII(aPathLatin)) {
798 MESSAGE("ConvertFromASCIIToHDF(" << aPathLatin << ")");
799 char* aResultPath = HDFascii::ConvertFromASCIIToHDF(aPathLatin);
800 MESSAGE("ConvertFromASCIIToHDF() DONE : " << aResultPath);
801 char* aHDFFileName = new char[strlen(aResultPath) + 19];
802 sprintf(aHDFFileName, "%shdf_from_ascii.hdf", aResultPath);
804 if (theIsMultiFile) { // set this file as new - temporary
805 static QString aCommand;
806 aCommand.sprintf(" %s %s%s",aHDFFileName, aResultPath, myFileInfo.baseName().latin1());
807 aCommand = QDir::convertSeparators( aCommand );
808 aCommand.prepend( MOVE_COMMAND );
810 if (system(aCommand.latin1()) == -1) {
811 if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - Can't execute the command :" << aCommand);
814 if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - " << aCommand);
816 myFileInfo.setFile(QString(aResultPath) + QString(myFileInfo.baseName().latin1()));
817 } else { // change current temporary file to the new: with hdf-format
818 static QString aCommand;
819 aCommand.sprintf(" %s %s\0",aHDFFileName, myFileInfo.filePath().latin1());
820 aCommand = QDir::convertSeparators( aCommand );
821 aCommand.prepend( MOVE_COMMAND );
823 if (system(aCommand.latin1()) == -1) {
824 if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - Can't execute the command :" << aCommand);
827 if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - " << aCommand);
829 SALOMEDS::ListOfFileNames_var anEmptyList = new SALOMEDS::ListOfFileNames;
830 SALOMEDS_Tool::RemoveTemporaryFiles(aResultPath, anEmptyList.in(), true);
832 mySourceId = eRestoredFile;
834 delete(aHDFFileName);
835 } else if (!theIsMultiFile) {
836 mySourceId = eRestoredFile;
838 mySourceId = eSavedFile;
840 if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - mySourceId = " << mySourceId);
841 myInput.reset(CreateConvertor(myFileInfo.filePath().latin1()));
843 myInput->BuildEntities();
845 myInput->BuildFields();
846 myIsFieldsDone = true;
848 myInput->BuildMinMax();
849 myIsMinMaxDone = true;
853 myInput->BuildGroups();
854 myIsGroupsDone = true;
858 aComment.sprintf("myComment=%s;myFileName=%s;myInitFileName=%s",
860 myFileInfo.filePath().latin1(),
861 GetInitFileName().c_str()); // Restoring of Python dump
862 SALOMEDS::GenericAttribute_var anAttr;
863 if (!theSObject->FindAttribute(anAttr, "AttributeString"))
864 throw std::runtime_error("Build - There is no AttributeString for the SObject !!!");
865 SALOMEDS::AttributeString_var aCmnt = SALOMEDS::AttributeString::_narrow(anAttr);
866 aCmnt->SetValue(aComment.latin1());
868 bool anIsBuildAll = VISU::GetResourceMgr()->booleanValue("VISU", "full_med_loading", false);
872 } catch(std::exception& exc) {
873 INFOS("Follow exception was occured :\n"<<exc.what());
875 INFOS("Unknown exception was occured!!!");
881 //---------------------------------------------------------------
882 VISU::Result_i::PInput
884 ::GetInput(const std::string& theMeshName,
885 VISU::Entity theEntity,
886 const std::string& theFieldName,
887 CORBA::Long theTimeStampNumber)
893 //---------------------------------------------------------------
900 (myIsBuildFields? myIsFieldsDone: true) &&
901 (myIsBuildMinMax? myIsMinMaxDone: true) &&
902 (myIsBuildGroups? myIsGroupsDone: true);
909 return myIsEntitiesDone;
914 ::SetBuildFields(CORBA::Boolean theIsBuildFields,
915 CORBA::Boolean theIsCalculateMinMax)
917 myIsBuildFields = theIsBuildFields;
919 myIsBuildMinMax = theIsCalculateMinMax;
921 myIsBuildMinMax = false;
926 ::SetBuildGroups(CORBA::Boolean theIsBuildGroups)
928 myIsBuildGroups = theIsBuildGroups;
935 return myIsFieldsDone;
942 return myIsGroupsDone;
949 return myIsMinMaxDone;
956 return myIsPartsDone;
960 //---------------------------------------------------------------
961 VISU::Result::EntityNames*
965 VISU::Result::EntityNames_var aResult = new VISU::Result::EntityNames();
966 const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
968 return aResult._retn();
970 aResult->length(aMeshMap.size());
971 VISU::TMeshMap::const_iterator anIter = aMeshMap.begin();
972 for(size_t anId = 0; anIter != aMeshMap.end(); anIter++, anId++){
973 const std::string& aName = anIter->first;
974 aResult[anId] = aName.c_str();
977 return aResult._retn();
981 //---------------------------------------------------------------
982 VISU::Result::Entities*
984 ::GetEntities(const char* theMeshName)
986 VISU::Result::Entities_var anEntities = new VISU::Result::Entities();
987 const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
989 return anEntities._retn();
991 VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
992 if(anIter == aMeshMap.end())
993 return anEntities._retn();
995 const VISU::PMesh& aMesh = anIter->second;
996 const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
997 if(aMeshOnEntityMap.empty())
998 return anEntities._retn();
1001 anEntities->length(aMeshOnEntityMap.size());
1002 VISU::TMeshOnEntityMap::const_iterator anIter = aMeshOnEntityMap.end();
1003 for(size_t anId = 0; anIter != aMeshOnEntityMap.end(); anIter++, anId++){
1004 const VISU::TEntity& anEntity = anIter->first;
1005 anEntities[anId] = VISU::Entity(anEntity);
1009 return anEntities._retn();
1013 //---------------------------------------------------------------
1014 VISU::Result::EntityNames*
1016 ::GetFamilies(const char* theMeshName,
1017 VISU::Entity theEntity)
1019 VISU::Result::EntityNames_var aResult = new VISU::Result::EntityNames();
1020 const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
1021 if(aMeshMap.empty())
1022 return aResult._retn();
1024 VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
1025 if(anIter == aMeshMap.end())
1026 return aResult._retn();
1028 const VISU::PMesh& aMesh = anIter->second;
1029 const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
1030 if(aMeshOnEntityMap.empty())
1031 return aResult._retn();
1034 VISU::TEntity anEntity = VISU::TEntity(theEntity);
1035 VISU::TMeshOnEntityMap::const_iterator anIter = aMeshOnEntityMap.find(anEntity);
1036 if(anIter == aMeshOnEntityMap.end())
1037 return aResult._retn();
1039 const VISU::PMeshOnEntity& aMeshOnEntity = anIter->second;
1040 const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
1041 if(aFamilyMap.empty())
1042 return aResult._retn();
1045 aResult->length(aFamilyMap.size());
1046 VISU::TFamilyMap::const_iterator anIter = aFamilyMap.end();
1047 for(size_t anId = 0; anIter != aFamilyMap.end(); anIter++, anId++){
1048 const std::string& aName = anIter->first;
1049 aResult[anId] = aName.c_str();
1054 return aResult._retn();
1058 //---------------------------------------------------------------
1059 VISU::Result::EntityNames*
1061 ::GetGroups(const char* theMeshName)
1063 VISU::Result::EntityNames_var aResult = new VISU::Result::EntityNames();
1064 const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
1065 if(aMeshMap.empty())
1066 return aResult._retn();
1068 VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
1069 if(anIter == aMeshMap.end())
1070 return aResult._retn();
1072 const VISU::PMesh& aMesh = anIter->second;
1073 const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
1074 if(aGroupMap.empty())
1075 return aResult._retn();
1078 aResult->length(aGroupMap.size());
1079 VISU::TGroupMap::const_iterator anIter = aGroupMap.end();
1080 for(size_t anId = 0; anIter != aGroupMap.end(); anIter++, anId++){
1081 const std::string& aName = anIter->first;
1082 aResult[anId] = aName.c_str();
1086 return aResult._retn();
1090 //---------------------------------------------------------------
1091 VISU::Result::EntityNames*
1093 ::GetFields(const char* theMeshName,
1094 VISU::Entity theEntity)
1096 VISU::Result::EntityNames_var aResult = new VISU::Result::EntityNames();
1097 const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
1098 if(aMeshMap.empty())
1099 return aResult._retn();
1101 VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
1102 if(anIter == aMeshMap.end())
1103 return aResult._retn();
1105 const VISU::PMesh& aMesh = anIter->second;
1106 const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
1107 if(aMeshOnEntityMap.empty())
1108 return aResult._retn();
1111 VISU::TEntity anEntity = VISU::TEntity(theEntity);
1112 VISU::TMeshOnEntityMap::const_iterator anIter = aMeshOnEntityMap.find(anEntity);
1113 if(anIter == aMeshOnEntityMap.end())
1114 return aResult._retn();
1116 const VISU::PMeshOnEntity& aMeshOnEntity = anIter->second;
1117 const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
1118 if(aFieldMap.empty())
1119 return aResult._retn();
1122 aResult->length(aFieldMap.size());
1123 VISU::TFieldMap::const_iterator anIter = aFieldMap.end();
1124 for(size_t anId = 0; anIter != aFieldMap.end(); anIter++, anId++){
1125 const std::string& aName = anIter->first;
1126 aResult[anId] = aName.c_str();
1131 return aResult._retn();
1135 //---------------------------------------------------------------
1136 VISU::Result::TimeStampNumbers*
1138 ::GetTimeStampNumbers(const char* theMeshName,
1139 VISU::Entity theEntity,
1140 const char* theFieldName)
1142 VISU::Result::TimeStampNumbers_var aResult = new VISU::Result::TimeStampNumbers();
1143 const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
1144 if(aMeshMap.empty())
1145 return aResult._retn();
1147 VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
1148 if(anIter == aMeshMap.end())
1149 return aResult._retn();
1151 const VISU::PMesh& aMesh = anIter->second;
1152 const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
1153 if(aMeshOnEntityMap.empty())
1154 return aResult._retn();
1157 VISU::TEntity anEntity = VISU::TEntity(theEntity);
1158 VISU::TMeshOnEntityMap::const_iterator anIter = aMeshOnEntityMap.find(anEntity);
1159 if(anIter == aMeshOnEntityMap.end())
1160 return aResult._retn();
1162 const VISU::PMeshOnEntity& aMeshOnEntity = anIter->second;
1163 const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
1164 if(aFieldMap.empty())
1165 return aResult._retn();
1168 VISU::TFieldMap::const_iterator anIter = aFieldMap.find(theFieldName);
1169 if(anIter == aFieldMap.end())
1170 return aResult._retn();
1173 const VISU::PField& aField = anIter->second;
1174 const VISU::TValField& aValField = aField->myValField;
1175 if(aValField.empty())
1176 return aResult._retn();
1179 aResult->length(aValField.size());
1180 VISU::TValField::const_iterator anIter = aValField.end();
1181 for(size_t anId = 0; anIter != aValField.end(); anIter++, anId++){
1182 const vtkIdType& aTimeStampNumber = anIter->first;
1183 aResult[anId] = aTimeStampNumber;
1190 return aResult._retn();
1194 //---------------------------------------------------------------
1197 ::GetNumberOfComponents(const char* theMeshName,
1198 VISU::Entity theEntity,
1199 const char* theFieldName)
1201 CORBA::Long aResult = 0;
1202 const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
1203 if(aMeshMap.empty())
1206 VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
1207 if(anIter == aMeshMap.end())
1210 const VISU::PMesh& aMesh = anIter->second;
1211 const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
1212 if(aMeshOnEntityMap.empty())
1216 VISU::TEntity anEntity = VISU::TEntity(theEntity);
1217 VISU::TMeshOnEntityMap::const_iterator anIter = aMeshOnEntityMap.find(anEntity);
1218 if(anIter == aMeshOnEntityMap.end())
1221 const VISU::PMeshOnEntity& aMeshOnEntity = anIter->second;
1222 const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
1223 if(aFieldMap.empty())
1227 VISU::TFieldMap::const_iterator anIter = aFieldMap.find(theFieldName);
1228 if(anIter == aFieldMap.end())
1232 const VISU::PField& aField = anIter->second;
1233 aResult = aField->myNbComp;
1242 //---------------------------------------------------------------
1243 VISU::Result::EntityNames*
1245 ::GetPartNames(const char* theMeshName)
1247 VISU::Result::EntityNames_var aResult = new VISU::Result::EntityNames();
1248 return aResult._retn();
1252 //---------------------------------------------------------------
1253 VISU::Result::Resolutions*
1255 ::GetResolutions(const char* theMeshName,
1256 const char* thePartName)
1258 VISU::Result::Resolutions_var aResult = new VISU::Result::Resolutions();
1259 return aResult._retn();
1263 //---------------------------------------------------------------
1264 VISU::Result::Resolution
1266 ::GetResolution(const char* theMeshName,
1267 const char* thePartName)
1269 return VISU::Result::HIDDEN;
1273 //---------------------------------------------------------------
1276 ::SetResolution(const char* theMeshName,
1277 const char* thePartName,
1278 VISU::Result::Resolution theResolution)
1282 //---------------------------------------------------------------
1285 ::New(SALOMEDS::Study_ptr theStudy,
1286 const ESourceId& theSourceId,
1287 const ECreationId& theCreationId,
1288 CORBA::Boolean theIsBuildImmediately,
1289 CORBA::Boolean theIsBuildFields,
1290 CORBA::Boolean theIsBuildMinMax,
1291 CORBA::Boolean theIsBuildGroups)
1293 return new RESULT_CLASS_NAME(theStudy,
1296 theIsBuildImmediately,
1303 //---------------------------------------------------------------
1306 ::StorableEngine(SALOMEDS::SObject_ptr theSObject,
1307 const Storable::TRestoringMap& theMap,
1308 const std::string& thePrefix,
1309 CORBA::Boolean theIsMultiFile)
1311 VISU::Result_i* aResult = new RESULT_CLASS_NAME();
1312 return aResult->Restore(theSObject, theMap, thePrefix, theIsMultiFile);
1316 //---------------------------------------------------------------
1319 ::ToStream(std::ostringstream& theStr)
1321 Storable::DataToStream(theStr,"myName", GetFileName().c_str());
1322 Storable::DataToStream(theStr,"myInitFileName", GetInitFileName().c_str());
1323 Storable::DataToStream(theStr,"myCreationId", myCreationId);
1324 Storable::DataToStream(theStr,"myIsBuildFields", myIsFieldsDone);
1325 Storable::DataToStream(theStr,"myIsBuildMinMax", myIsMinMaxDone);
1326 Storable::DataToStream(theStr,"myIsBuildGroups", myIsGroupsDone);
1330 //---------------------------------------------------------------
1333 ::GetInitFileName() const
1335 return myInitFileName;
1341 ::SetInitFileName(const std::string& theFileName)
1343 myInitFileName = theFileName;
1347 //---------------------------------------------------------------
1350 ::GetFileName() const
1352 if(GetSourceId() == eFile)
1353 return VISU::MakeFileName(myFileName, this);
1361 ::GetFileInfo() const
1366 VISU::Result_i::ECreationId
1368 ::GetCreationId() const
1370 return myCreationId;
1374 VISU::Result_i::ESourceId
1376 ::GetSourceId() const
1382 //---------------------------------------------------------------
1387 CORBA::String_var anEntry = mySObject->GetID();
1388 return anEntry.in();
1391 SALOMEDS::SObject_var
1393 ::GetSObject() const
1400 ::GetStudyDocument() const
1402 return myStudyDocument;
1412 SALOMEDS::SComponent_var
1414 ::GetSComponent() const
1416 return mySComponent;
1421 ::GetEntry(const Storable::TRestoringMap& theRestoringMap)
1423 return Storable::FindEntry(myStudyDocument,
1429 //=======================================================================
1430 //function : GetAxisInfo
1432 //=======================================================================
1433 const VISU::Result_i::TAxisInfo*
1435 ::GetAxisInfo(const string& theMeshName,
1437 gp_Dir& thePlaneNormal)
1439 const TAxisInfo* components = NULL;
1441 if ( theAxis < AXIS_X || theAxis > AXIS_Z ) {
1442 MESSAGE(" Bad axis index " << theAxis );
1446 map< string, TGridInfo >::iterator name_info;
1447 name_info = myMeshName2GridInfoMap.find( theMeshName );
1448 TGridInfo * gInfo = 0;
1450 if ( name_info != myMeshName2GridInfoMap.end() )
1452 gInfo = & name_info->second;
1454 else if ( myInput && IsPossible() && theAxis >= AXIS_X && theAxis <= AXIS_Z )
1456 // check presence of theMeshName
1457 const VISU::TMeshMap& meshMap = myInput->GetMeshMap();
1459 VISU::TMeshMap::const_iterator aIter = meshMap.find( theMeshName );
1460 if ( aIter == meshMap.end() ) {
1461 MESSAGE("No mesh named " << theMeshName );
1464 theMesh = aIter->second;
1466 VISU::PUnstructuredGridIDMapper anIDMapper = myInput->GetMeshOnEntity(theMeshName,
1468 vtkUnstructuredGrid* aMesh = anIDMapper->GetUnstructuredGridOutput();
1470 if ( !aMesh || aMesh->GetNumberOfCells() == 0 ) {
1471 MESSAGE( "No cells in the mesh: " << theMeshName );
1475 if ( !theMesh->IsStructured() || theMesh->myType ) {
1476 // define axis directions and min cell size in each direction
1477 const int nbAxes = 3;
1479 gp_Vec axDirs[ nbAxes ];
1480 float minSize[3] = { FLT_MAX, FLT_MAX, FLT_MAX };
1481 bool axesComputed = false;
1482 for ( vtkIdType iCell = 0; iCell < aMesh->GetNumberOfCells(); ++iCell ) {
1483 vtkCell* cell = aMesh->GetCell( iCell );
1484 int nbPnt = cell->GetNumberOfPoints();
1487 vtkPoints * points = cell->GetPoints();
1488 vtkFloatingPointType coords[ 4 ][3];
1489 points->GetPoint( 0, coords[0] );
1490 points->GetPoint( 1, coords[1] );
1491 points->GetPoint( 3, coords[2] );
1492 points->GetPoint( 4, coords[3] );
1493 gp_Pnt p0( coords[0][0], coords[0][1], coords[0][2] );
1494 for ( iAx = 0; iAx < nbAxes; ++iAx ) {
1495 vtkFloatingPointType* coo = coords[ iAx + 1 ];
1496 gp_Pnt p( coo[0], coo[1], coo[2] );
1498 vtkFloatingPointType size = p0.SquareDistance( p );
1499 if ( size > FLT_MIN && size < minSize[ iAx ] )
1500 minSize[ iAx ] = size;
1502 if ( !axesComputed ) {
1503 gp_Vec dir( p0, p );
1504 if ( dir.SquareMagnitude() <= gp::Resolution() ) {
1507 axDirs[ iAx ] = dir;
1510 if ( iAx == nbAxes )
1511 axesComputed = true;
1513 if ( !axesComputed ) {
1514 MESSAGE("No good hexahedrons in the mesh: " << theMeshName );
1518 // compute axes dirs
1519 gInfo = & myMeshName2GridInfoMap[ theMeshName ];
1520 for ( iAx = 0; iAx < nbAxes; ++iAx ) {
1521 int iPrev = ( iAx == 0 ) ? 2 : iAx - 1;
1522 int iNext = ( iAx == 2 ) ? 0 : iAx + 1;
1523 gInfo->myAxis[ iAx ] = axDirs[ iPrev ] ^ axDirs[ iNext ];
1526 // get and sort intermediate component values - projections of nodes
1527 // on axis direction; define bnd box
1528 set< vtkFloatingPointType > comps[ 3 ];
1530 vtkPoints * points = aMesh->GetPoints();
1531 vtkIdType iP, nbP = aMesh->GetNumberOfPoints();
1532 for ( iP = 0; iP < nbP; ++iP ) {
1533 vtkFloatingPointType coo[3];
1534 points->GetPoint( iP, coo );
1535 gp_Pnt p( coo[0], coo[1], coo[2] );
1537 for ( iAx = 0; iAx < nbAxes; ++iAx ) {
1538 const gp_Dir& dir = gInfo->myAxis[ iAx ];
1539 vtkFloatingPointType dot = dir.XYZ() * p.XYZ();
1540 comps[ iAx ].insert( dot );
1544 // find a range of projections of bnd box corners on each axis
1545 vtkFloatingPointType range[3], firstValue[3];
1546 double x[2],y[2],z[2];
1547 box.Get(x[0],y[0],z[0],x[1],y[1],z[1]);
1548 for ( iAx = 0; iAx < nbAxes; ++iAx ) {
1549 set< vtkFloatingPointType > bndComps;
1550 const gp_Dir& dir = gInfo->myAxis[ iAx ];
1551 for ( int iX = 0; iX < 2; ++iX ) {
1552 for ( int iY = 0; iY < 2; ++iY ) {
1553 for ( int iZ = 0; iZ < 2; ++iZ ) {
1554 gp_Pnt p( x[ iX ], y[ iY ], z[ iZ ] );
1555 vtkFloatingPointType dot = dir.XYZ() * p.XYZ();
1556 bndComps.insert( dot );
1560 firstValue[ iAx ] = *bndComps.begin();
1561 range[ iAx ] = *bndComps.rbegin() - *bndComps.begin();
1564 // compute component values
1565 for ( iAx = 0; iAx < nbAxes; ++iAx ) {
1566 list< vtkFloatingPointType > values;
1568 set< vtkFloatingPointType >& comp = comps[ iAx ];
1569 set< vtkFloatingPointType >::iterator val = comp.begin();
1570 vtkFloatingPointType bnd = -1., rng = range[ iAx ], first = firstValue[ iAx ];
1571 vtkFloatingPointType tol = 0.1 * sqrt( minSize[ iAx ]) / rng;
1572 for ( ; val != comp.end(); ++val ) {
1573 vtkFloatingPointType value = ( *val - first ) / rng;
1574 if ( value > bnd ) {
1575 values.push_back( value );
1580 // store values in gInfo
1581 vector< vtkFloatingPointType >& myComp = gInfo->myComponets[ iAx ];
1582 myComp.resize( nbVals );
1583 list< vtkFloatingPointType >::iterator v = values.begin();
1584 for ( int i = 0; v != values.end(); ++v ){
1590 //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
1591 TIdTypeVector aIndexes = theMesh->GetStructure();
1593 gInfo = & myMeshName2GridInfoMap[ theMeshName ];
1594 switch(aIndexes.size()){
1596 gp_Dir aDir(0.0,0.0,1.0);
1597 gInfo->myAxis[ 2 ] = aDir;
1600 gp_Dir aDir(0.0,1.0,0.0);
1601 gInfo->myAxis[ 1 ] = aDir;
1604 gp_Dir aDir(1.0,0.0,0.0);
1605 gInfo->myAxis[ 0 ] = aDir;
1608 int nbPoints = aMesh->GetNumberOfPoints();
1609 vtkFloatingPointType* coords[ 2 ];
1610 if ( nbPoints > 1 ) {
1611 coords[0] = aMesh->GetPoints()->GetPoint(0);
1612 coords[1] = aMesh->GetPoints()->GetPoint(nbPoints-1);
1615 vector<vtkFloatingPointType> PointsCoords[3];
1616 TIdTypeVector aCoordIJK;
1617 switch ( aIndexes.size() ) {
1619 vtkIdType nbZ = aIndexes[2];
1621 aCoordIJK.resize(aIndexes.size(),1);
1622 for(int i=0;i<nbZ;i++){
1624 vtkIdType aObjID = anIDMapper->GetObjectIDByIndexes(aCoordIJK);
1625 vtkIdType aVTKID = anIDMapper->GetNodeVTKID(aObjID);
1626 vtkFloatingPointType* aPCoord = aMesh->GetPoints()->GetPoint(aVTKID);
1627 PointsCoords[2].push_back(aPCoord[2]);
1631 vtkIdType nbJ = aIndexes[1];
1633 aCoordIJK.resize(aIndexes.size(),1);
1634 for(int i=0;i<nbJ;i++){
1636 vtkIdType aObjID = anIDMapper->GetObjectIDByIndexes(aCoordIJK);
1637 vtkIdType aVTKID = anIDMapper->GetNodeVTKID(aObjID);
1638 vtkFloatingPointType* aPCoord = aMesh->GetPoints()->GetPoint(aVTKID);
1639 PointsCoords[1].push_back(aPCoord[1]);
1643 vtkIdType nbI = aIndexes[0];
1645 aCoordIJK.resize(aIndexes.size(),1);
1646 for(int i=0;i<nbI;i++){
1648 vtkIdType aObjID = anIDMapper->GetObjectIDByIndexes(aCoordIJK);
1649 vtkIdType aVTKID = anIDMapper->GetNodeVTKID(aObjID);
1650 vtkFloatingPointType* aPCoord = aMesh->GetPoints()->GetPoint(aVTKID);
1651 PointsCoords[0].push_back(aPCoord[0]);
1654 for(int i=0;i<aIndexes.size();i++){
1655 vector< vtkFloatingPointType >& myComp = gInfo->myComponets[ i ];
1656 int aSize = PointsCoords[i].size();
1658 vtkFloatingPointType aLen = PointsCoords[i][aSize-1] - PointsCoords[i][0];
1659 myComp.resize(aSize);
1661 for(int k=1;k<aSize;k++){
1662 myComp[k]=myComp[k-1] + (PointsCoords[i][k]-PointsCoords[i][k-1])/aLen;
1671 // set return values
1673 thePlaneNormal = gInfo->myAxis[ theAxis ];
1674 components = & gInfo->myComponets[ theAxis ];