From 9dd0098207ee1100659acd0545473c198ec96f42 Mon Sep 17 00:00:00 2001 From: apo Date: Fri, 1 Jun 2007 13:05:20 +0000 Subject: [PATCH] To clarify IDL. 1. It is forbiden to change input of Prs3d objects outside of "3D Cache System". So, corresponding functions are removed from IDL (but stays as it is in implementation) 2. "ScalaraMapOnDefomedShape" presentation was modified in the following way: a) Method void SetScalarField(in string theMeshName, in string theFieldName, in long theIteration, in Entity theEntity) was changed to the void SetScalarField(in Entity theEntity, in string theFieldName, in long theTimeStampNumber) b) Method string GetScalarCMeshName() was removed at all c) Method Entity GetScalarEEntity() was changed to the Entity GetScalarEntity(); c) Method long GetScalarLIteration(); was changed to the long GetScalarTimeStampNumber(); d) Method string GetScalarCFieldName(); was changed to the string GetScalarFieldName(); --- src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc | 69 ++++-------- src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh | 22 +--- src/VISU_SWIG/visu_change_input.py | 106 ------------------ 3 files changed, 25 insertions(+), 172 deletions(-) delete mode 100644 src/VISU_SWIG/visu_change_input.py diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc index bf78b111..2dacbee6 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc @@ -142,15 +142,14 @@ VISU::ScalarMapOnDeformedShape_i const std::string& theFieldName, CORBA::Long theTimeStampNumber) { - SetScalarField(theMeshName.c_str(), - theFieldName.c_str(), - theTimeStampNumber, - theEntity); - - return TSuperClass::Create(theMeshName, + TSuperClass::Create(theMeshName, theEntity, theFieldName, theTimeStampNumber); + SetScalarField(theEntity, + theFieldName.c_str(), + theTimeStampNumber); + return this; } @@ -169,10 +168,9 @@ VISU::ScalarMapOnDeformedShape_i QString aFieldName = VISU::Storable::FindValue(theMap,"myScalarFieldName"); int aTimeStampNumber = VISU::Storable::FindValue(theMap,"myScalarIteration").toInt(); - SetScalarField(aMeshName, + SetScalarField(anEntity, aFieldName, - aTimeStampNumber, - anEntity); + aTimeStampNumber); SetScale(VISU::Storable::FindValue(theMap,"myFactor").toDouble()); @@ -187,10 +185,9 @@ VISU::ScalarMapOnDeformedShape_i { TSuperClass::ToStream(theStr); + Storable::DataToStream( theStr, "myScalarEntity", int(myScalarEntity)); Storable::DataToStream( theStr, "myScalarFieldName", myScalarFieldName.c_str()); - Storable::DataToStream( theStr, "myScalarMeshName", myScalarMeshName.c_str()); Storable::DataToStream( theStr, "myScalarIteration", int(myScalarTimeStampNumber)); - Storable::DataToStream( theStr, "myScalarEntity", int(myScalarEntity)); Storable::DataToStream( theStr, "myFactor", GetScale() ); } @@ -213,13 +210,11 @@ VISU::ScalarMapOnDeformedShape_i if(const ScalarMapOnDeformedShape_i* aPrs3d = dynamic_cast(theOrigin)){ ScalarMapOnDeformedShape_i* anOrigin = const_cast(aPrs3d); - CORBA::String_var aMeshName = anOrigin->GetScalarCMeshName(); - CORBA::String_var aFieldName = anOrigin->GetScalarCFieldName(); + CORBA::String_var aFieldName = anOrigin->GetScalarFieldName(); - SetScalarField(aMeshName, + SetScalarField(anOrigin->GetScalarEntity(), aFieldName, - anOrigin->GetScalarLIteration(), - anOrigin->GetScalarEEntity()); + anOrigin->GetScalarTimeStampNumber()); Update(); } } @@ -314,16 +309,12 @@ VISU::ScalarMapOnDeformedShape_i //--------------------------------------------------------------- void VISU::ScalarMapOnDeformedShape_i -::SetScalarField(const char* theMeshName, - const char* theFieldName, - CORBA::Long theTimeStampNumber, - VISU::Entity theEntity) +::SetScalarField(VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theTimeStampNumber) { bool anIsModified = false; - if(!anIsModified) - anIsModified |= myScalarMeshName != theMeshName; - if(!anIsModified) anIsModified |= myScalarEntity != theEntity; @@ -338,10 +329,10 @@ VISU::ScalarMapOnDeformedShape_i VISU::TEntity aEntity = VISU::TEntity(theEntity); VISU::Result_i::TInput* anInput = GetCResult()->GetInput(); - myScalarField = anInput->GetField(theMeshName, aEntity, theFieldName); + myScalarField = anInput->GetField(GetCMeshName(), aEntity, theFieldName); VISU::PUnstructuredGridIDMapper anIDMapper = - anInput->GetTimeStampOnMesh(theMeshName, + anInput->GetTimeStampOnMesh(GetCMeshName(), aEntity, theFieldName, theTimeStampNumber); @@ -351,7 +342,6 @@ VISU::ScalarMapOnDeformedShape_i ProcessVoidEvent(new TVoidMemFun1ArgEvent (GetSpecificPL(), &VISU_ScalarMapOnDeformedShapePL::SetScalars, anOutput)); - myScalarMeshName = theMeshName; myScalarEntity = theEntity; myScalarFieldName = theFieldName; myScalarTimeStampNumber = theTimeStampNumber; @@ -365,19 +355,10 @@ VISU::ScalarMapOnDeformedShape_i } -//--------------------------------------------------------------- -char* -VISU::ScalarMapOnDeformedShape_i -::GetScalarCMeshName() -{ - return CORBA::string_dup(myScalarMeshName.c_str()); -} - - //--------------------------------------------------------------- VISU::Entity VISU::ScalarMapOnDeformedShape_i -::GetScalarEEntity() +::GetScalarEntity() { return myScalarEntity; } @@ -386,7 +367,7 @@ VISU::ScalarMapOnDeformedShape_i //--------------------------------------------------------------- char* VISU::ScalarMapOnDeformedShape_i -::GetScalarCFieldName() +::GetScalarFieldName() { return CORBA::string_dup(myScalarFieldName.c_str()); } @@ -395,7 +376,7 @@ VISU::ScalarMapOnDeformedShape_i //--------------------------------------------------------------- CORBA::Long VISU::ScalarMapOnDeformedShape_i -::GetScalarLIteration() +::GetScalarTimeStampNumber() { return myScalarTimeStampNumber; } @@ -408,15 +389,3 @@ VISU::ScalarMapOnDeformedShape_i { return myScalarField; } - - -//--------------------------------------------------------------- -CORBA::Long -VISU::ScalarMapOnDeformedShape_i -::GetScalarTimeStampNumber() const -{ - return myScalarTimeStampNumber; -} - - -//--------------------------------------------------------------- diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh index 8a9d34ed..b4c8d40e 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh @@ -147,42 +147,32 @@ namespace VISU virtual void - SetScalarField(const char* theMeshName, + SetScalarField(VISU::Entity theEntity, const char* theFieldName, - CORBA::Long theTimeStampNumber, - VISU::Entity theEntity); - - virtual - char* - GetScalarCMeshName(); + CORBA::Long theTimeStampNumber); virtual VISU::Entity - GetScalarEEntity(); + GetScalarEntity(); virtual char* - GetScalarCFieldName(); + GetScalarFieldName(); virtual CORBA::Long - GetScalarLIteration(); + GetScalarTimeStampNumber(); virtual const VISU::PField& GetScalarField() const; - virtual - CORBA::Long - GetScalarTimeStampNumber() const; - private: VISU_ScalarMapOnDeformedShapePL *myScalarMapOnDeformedShapePL; PField myScalarField; - std::string myScalarMeshName; - std::string myScalarFieldName; VISU::Entity myScalarEntity; + std::string myScalarFieldName; CORBA::Long myScalarTimeStampNumber; }; } diff --git a/src/VISU_SWIG/visu_change_input.py b/src/VISU_SWIG/visu_change_input.py deleted file mode 100644 index 06f66af9..00000000 --- a/src/VISU_SWIG/visu_change_input.py +++ /dev/null @@ -1,106 +0,0 @@ -import os -import time -import VISU -import SALOMEDS -from batchmode_visu import * - -#--------------------------------------------------------------- -def GetPrsType2OldFactoryMethod(theVISUType): - if theVISUType == VISU.TGAUSSPOINTS: - return myVisu.GaussPointsOnField - if theVISUType == VISU.TSCALARMAP: - return myVisu.ScalarMapOnField - if theVISUType == VISU.TISOSURFACES: - return myVisu.IsoSurfacesOnField - if theVISUType == VISU.TCUTPLANES: - return myVisu.CutPlanesOnField - if theVISUType == VISU.TCUTLINES: - return myVisu.CutLinesOnField - if theVISUType == VISU.TPLOT3D: - return myVisu.Plot3DOnField - if theVISUType == VISU.TDEFORMEDSHAPE: - return myVisu.DeformedShapeOnField - if theVISUType == VISU.TVECTORS: - return myVisu.VectorsOnField - if theVISUType == VISU.TSTREAMLINES: - return myVisu.StreamLinesOnField - if theVISUType == VISU.TSCALARMAPONDEFORMEDSHAPE: - return myVisu.ScalarMapOnDeformedShapeOnField - return None - - -#--------------------------------------------------------------- -def WalkTroughTimeStamps(theVISUType, - theResult, theMeshName,theEntity, theFieldName, theTimeStampNumber, - theViewManager): - anOldFactoryMethod = GetPrsType2OldFactoryMethod(theVISUType) - aPrs3d = anOldFactoryMethod(theResult, theMeshName, theEntity, theFieldName, theTimeStampNumber) - - aPrs3d = myVisu.CreatePrs3d(theVISUType, myVisu.GetCurrentStudy()) - aPrs3d.SetResultObject(theResult) - aPrs3d.SetMeshName(theMeshName) - aPrs3d.SetEntity(theEntity) - aPrs3d.SetFieldName(theFieldName) - aPrs3d.SetTimeStampNumber(theTimeStampNumber) - if not aPrs3d.Apply(0): - print "It is impossible to create such kind of presentation (%s) with the given parameters" % theVISUType - print "\ttheMeshName = '%s'" % theMeshName - print "\ttheEntity = %s" % theEntity - print "\ttheFieldName = '%s'" % theFieldName - print "\ttheTimeStampNumber = %s" % theTimeStampNumber - return - - aView = theViewManager.Create3DView(); - aView.SetTitle("To test presentation of %s type" % theVISUType) - aView.Display(aPrs3d); - aView.FitAll() - - aDelay = 0.0 - aRange = aPrs3d.GetTimeStampsRange() - for anInfo in aRange: - print "%d (%s); " % (anInfo.myNumber, anInfo.myTime) - aPrs3d.SetTimeStampNumber(anInfo.myNumber) - aPrs3d.Apply(0) - aView.Update(); - time.sleep(aDelay) - pass - pass - - -#--------------------------------------------------------------- -PRS3D_TYPE_LIST = [] -PRS3D_TYPE_LIST.append(VISU.TGAUSSPOINTS) -PRS3D_TYPE_LIST.append(VISU.TSCALARMAP) -PRS3D_TYPE_LIST.append(VISU.TISOSURFACES) -PRS3D_TYPE_LIST.append(VISU.TCUTPLANES) -PRS3D_TYPE_LIST.append(VISU.TCUTLINES) -PRS3D_TYPE_LIST.append(VISU.TPLOT3D) -PRS3D_TYPE_LIST.append(VISU.TDEFORMEDSHAPE) -PRS3D_TYPE_LIST.append(VISU.TVECTORS) -PRS3D_TYPE_LIST.append(VISU.TSTREAMLINES) -PRS3D_TYPE_LIST.append(VISU.TSCALARMAPONDEFORMEDSHAPE) - - -#--------------------------------------------------------------- -aMedFile = "TimeStamps.med" -aMedFile = "ResOK_0000.med" -aMedFile = os.getenv('DATA_DIR') + '/MedFiles/' + aMedFile -aResult = myVisu.ImportFile(aMedFile) - -aMeshName ="dom" -anEntity = VISU.NODE -aFieldName = "vitesse"; -aTimeStampNumber = 1 - -aViewManager = myVisu.GetViewManager(); - -WalkTroughTimeStamps(VISU.TSCALARMAPONDEFORMEDSHAPE, aResult, aMeshName, anEntity, aFieldName, aTimeStampNumber, aViewManager) - -for aVISUType in PRS3D_TYPE_LIST: - WalkTroughTimeStamps(aVISUType, aResult, aMeshName, anEntity, aFieldName, aTimeStampNumber, aViewManager) - pass - -anEntity = VISU.CELL -aFieldName = "pression"; - -WalkTroughTimeStamps(VISU.TGAUSSPOINTS, aResult, aMeshName, anEntity, aFieldName, aTimeStampNumber, aViewManager) -- 2.39.2