From: enk Date: Wed, 1 Mar 2006 07:14:48 +0000 (+0000) Subject: Added creation of ScalarMapOnDeformedShape in batch mode X-Git-Tag: mergeto_trunk_13Mar06~22 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=533ba0cf32e1e4903baeb9544694f45baaf678b4;p=modules%2Fvisu.git Added creation of ScalarMapOnDeformedShape in batch mode --- diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index 5f7648d6..af87ae1c 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -599,6 +599,16 @@ module VISU { */ double GetScale(); + /*! + * Sets the scalar field + * \param theMeshName - mesh name + * \param theFieldName - the name of scalar field + * \param theIteration - the iteration number for scalar field + * \param theEntity - entity of scalar field + */ + void SetScalarField(in string theMeshName,in string theFieldName, + in long theIteration,in Entity theEntity); + }; //------------------------------------------------------- /*! @@ -1450,6 +1460,18 @@ module VISU { in Entity theEntity, in string theFieldName, in double theIteration); + /*! + * Creates a deformed shape presentation. + * \param theResult Data generated in other sources. (MED object or file) + * \param theMeshName One of the meshes presented in MED file + * \param theEntity Type of entity where the field is defined + * \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector. + * \param theIteration Number of iteration on the field + */ + ScalarMapOnDeformedShape ScalarMapOnDeformedShapeOnField(in Result theResult, in string theMeshName, + in Entity theEntity, in string theFieldName, + in double theIteration); + /*! * Creates a vector presentation. * \param theResult Data generated in other sources. (MED object or file) diff --git a/src/ENGINE/VISU_Engine_i.cc b/src/ENGINE/VISU_Engine_i.cc index 45dc68bc..b1a29e01 100644 --- a/src/ENGINE/VISU_Engine_i.cc +++ b/src/ENGINE/VISU_Engine_i.cc @@ -236,6 +236,14 @@ namespace VISU{ return myVisuGen->DeformedShapeOnField(theResult,theMeshName,theEntity,theFieldName,theIteration); } + ScalarMapOnDeformedShape_ptr VISU_Gen_i::ScalarMapOnDeformedShapeOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Double theIteration) + { + return myVisuGen->ScalarMapOnDeformedShapeOnField(theResult,theMeshName,theEntity,theFieldName,theIteration); + } Vectors_ptr VISU_Gen_i::VectorsOnField(Result_ptr theResult, const char* theMeshName, diff --git a/src/ENGINE/VISU_Engine_i.hh b/src/ENGINE/VISU_Engine_i.hh index d9c665ac..b56e216c 100644 --- a/src/ENGINE/VISU_Engine_i.hh +++ b/src/ENGINE/VISU_Engine_i.hh @@ -86,6 +86,8 @@ namespace VISU{ const char* theFieldName, CORBA::Double theIteration); virtual Plot3D_ptr Plot3DOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, CORBA::Double theIteration); + virtual ScalarMapOnDeformedShape_ptr ScalarMapOnDeformedShapeOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, + const char* theFieldName, CORBA::Double theIteration); //Create Digital Presentation virtual Table_ptr CreateTable(const char* theTableEntry); virtual Curve_ptr CreateCurve(Table_ptr theTable, CORBA::Long theHRow, CORBA::Long theVRow); diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc index d462ab8f..c9ee0e66 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc @@ -271,6 +271,13 @@ void VISU::ScalarMapOnDeformedShape_i::SetScalarField(const char* theMeshName, this->SetScalarEntity(theEntity); } +void VISU::ScalarMapOnDeformedShape_i::SetScalarField(const char* theMeshName, + const char* theFieldName, + const long theIteration, + const VISU::Entity theEntity) +{ + this->SetScalarField(theMeshName,theFieldName,(int)theIteration,VISU::TEntity(theEntity)); +} void VISU::ScalarMapOnDeformedShape_i::SetScalarMeshName(const char* theName){ myScalarMeshName = theName; @@ -289,6 +296,8 @@ std::string VISU::ScalarMapOnDeformedShape_i::GetScalarFieldName(){ void VISU::ScalarMapOnDeformedShape_i::SetScalarIteration(const int theValue){ myScalarIteration = theValue; } + + int VISU::ScalarMapOnDeformedShape_i::GetScalarIteration(){ return myScalarIteration; } @@ -296,10 +305,19 @@ int VISU::ScalarMapOnDeformedShape_i::GetScalarIteration(){ void VISU::ScalarMapOnDeformedShape_i::SetScalarEntity(const VISU::TEntity theValue){ myScalarEntity = theValue; } + VISU::TEntity VISU::ScalarMapOnDeformedShape_i::GetScalarEntity(){ return myScalarEntity; } +void VISU::ScalarMapOnDeformedShape_i::SetScalarEEntity(const VISU::Entity theValue){ + myScalarEntity = VISU::TEntity(theValue); +} + +VISU::Entity VISU::ScalarMapOnDeformedShape_i::GetScalarEEntity(){ + return VISU::Entity(myScalarEntity); +} + const VISU::PField& VISU::ScalarMapOnDeformedShape_i ::GetField() const diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh index 0a2ee955..cdd1444a 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh @@ -123,6 +123,11 @@ namespace VISU{ const char* theFieldName, const int theIteration, const VISU::TEntity theEntity); + + virtual void SetScalarField(const char* theMeshName, + const char* theFieldName, + const long theIteration, + const VISU::Entity theEntity); virtual void SetScalarFieldName(const char* theName); virtual std::string GetScalarFieldName(); @@ -132,6 +137,8 @@ namespace VISU{ virtual std::string GetScalarMeshName(); virtual void SetScalarEntity(const VISU::TEntity theValue); virtual VISU::TEntity GetScalarEntity(); + virtual void SetScalarEEntity(const VISU::Entity theValue); + virtual VISU::Entity GetScalarEEntity(); }; } #endif diff --git a/src/VISU_SWIG/VISU_Example_01.py b/src/VISU_SWIG/VISU_Example_01.py index d8c19b65..e9727b81 100644 --- a/src/VISU_SWIG/VISU_Example_01.py +++ b/src/VISU_SWIG/VISU_Example_01.py @@ -80,6 +80,13 @@ cutplanes.SetNbPlanes(30) cutplanes.SetOrientation(VISU.CutPlanes.YZ, 0, 0) myView.DisplayOnly(cutplanes) +print "Creating Scalar Map On Deformed Shape.......", +scalarmapondefshape = myVisu.ScalarMapOnDeformedShapeOnField(myResult,myMeshName,myNodeEntity,'vitesse',1); +if scalarmapondefshape is None : print "Error" +else : print "OK" +scalarmapondefshape.SetScalarField(myMeshName,'pression',2,myCellEntity); +myView.DisplayOnly(scalarmapondefshape) + #%====================Stage4: Opening a new study and Med file import====================% # Opening a new study tempoparily commented due to a problem @@ -131,6 +138,11 @@ else : print "OK" cutplanes1.SetOrientation(VISU.CutPlanes.YZ, 0, 0) myView1.DisplayOnly(cutplanes1) +print "Creating Scalar Map On Deformed Shape.......", +scalarmapondefshape1 = myVisu.ScalarMapOnDeformedShapeOnField(myResult1,myMeshName1,myCellEntity,'vectoriel field',1); +if scalarmapondefshape1 is None : print "Error" +else : print "OK" +myView1.DisplayOnly(scalarmapondefshape1) #%====================Stage6: Object browser popup====================% print "**** Stage6: Object browser popup" diff --git a/src/VISU_SWIG/visu.py b/src/VISU_SWIG/visu.py index daadf7aa..4b7b4420 100644 --- a/src/VISU_SWIG/visu.py +++ b/src/VISU_SWIG/visu.py @@ -602,6 +602,23 @@ def CreatePrsForResult(theVisu, theResult, theView, thePrsTypeList, thePictureDi aPrsObj.RemoveFromStudy() else : aVISUObjList.append(aPrsObj) + + if HasValue(thePrsTypeList,VISU.TSCALARMAPONDEFORMEDSHAPE) : + print " Creating ScalarMapOnDeformedShapeOnField", + aPrsObj = theVisu.ScalarMapOnDeformedShapeOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId) + if aPrsObj is None : print "Error" + else : + print ",OK" + theView.DisplayOnly(aPrsObj) + theView.FitAll() + aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TSCALARMAPONDEFORMEDSHAPE." + thePictureExt + aPictureName = re.sub("\s+","_", aPictureName) + theView.SavePicture(aPictureName) + if theIsAutoDelete : + aPrsObj.RemoveFromStudy() + else : + aVISUObjList.append(aPrsObj) + return aVISUObjList