==========================================
Gestion de configuration du composant MEDCalc
--------------------------------------------
+---------------------------------------------
Le composant logiciel MEDCalc est un package du module SALOME MED,
hébergé dans l'espace source au niveau du sous-répertoire
module SALOME MED.
Organisation des sources du composant MEDCalc
--------------------------------------------
+---------------------------------------------
Le répertoire source `src/MEDCalc` distingue les sous-répertoires
suivants:
MEDCalc framework
Construction du composant MEDCalc
--------------------------------
+---------------------------------
Intégré à la construction du module MED. Le composant MEDCalc dépend de
MEDCoupling et MEDLoader uniquement.
Exécution des tests unitaires du composant MEDCalc
-------------------------------------------------
+--------------------------------------------------
Les tests unitaires peuvent être exécutés au moyen de scripts python
lancés depuis une session shell SALOME. Dans un nouveau shell, taper::
_fieldHandlerMap[fieldHandler->id] = fieldHandler;
// >>> WARNING: CORBA struct specification indicates that the
- // assignement acts as a desctructor for the structure that is
+ // assignment acts as a destructor for the structure that is
// pointed to. The values of the fields are copy first in the new
- // structure that receives the assignement and finally the initial
+ // structure that receives the assignment and finally the initial
// structure is destroyed. In the present case, WE WANT to keep
// the initial fieldHandler in the map. We must then make a deep
// copy of the structure found in the map and return the copy. The
Ces classes proxy sont conçues pour être le lieu d'implémentation de
l'interprétation des commandes utilisateur et donc de l'ergonomie
de manipulation des champs au niveau l'interface textuelle. Ce point
-est développé :ref:`plus bas <develguide_execFieldOperation>`.
+est développé :ref:`plus bas <develguide_execFieldOperation-fr>`.
Programmation de l'interface textuelle
--------------------------------------
.. |IMG_SELECT| image:: ../images/medop-gui-selectfield_scale.png
.. |IMG_ALIAS| image:: ../images/medop-gui-aliasfield_scale.png
-+---------------+---------------+
-| |IMG_SELECT| | |IMG_ALIAS| |
-+---------------+---------------+
++--------------+-------------+
+| |IMG_SELECT| | |IMG_ALIAS| |
++--------------+-------------+
L'image de gauche montre la sélection du pas de temps, l'image de
droite la boîte de dialogue qui permet la saisie de l'alias avec
``SALOME_MED::MEDOP`` créé sur demande par le servant
``SALOME_MED::MED``, voir la fonction ``getFieldFromMed(...)``).
-.. _develguide_execFieldOperation:
+.. _develguide_execFieldOperation-fr:
Exécution des opérations sur le champs
--------------------------------------
FIELD pow(in FIELD f, in long power) raises (SALOME::SALOME_Exception);
/*! Linear transformation of the field f (factor*f+offset) */
FIELD lin(in FIELD f, in double factor, in double offset) raises (SALOME::SALOME_Exception);
- /*! Dublication of the field f */
+ /*! Duplication of the field f */
FIELD dup(in FIELD f) raises (SALOME::SALOME_Exception);
Cette interface est implémentée dans la classe C++ ``MEDOP_i`` du
.. |IMG_VISU| image:: ../images/medop-gui-visufield_scale.png
.. |IMG_RESULT| image:: ../images/medop-gui-result_scale.png
-+---------------+---------------+
-| |IMG_VISU| | |IMG_RESULT| |
-+---------------+---------------+
++------------+--------------+
+| |IMG_VISU| | |IMG_RESULT| |
++------------+--------------+
Cette fonction répond au besoin de contrôle interactif des résultats
produits par les opérations de manipulation de champs.
import VISU
visuComp = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU")
- visuComp.SetCurrentStudy(salome.myStudy)
# Then we can import the specified field in the VISU module. This
# creates an study entry in the VISU folder.
FIELD pow(in FIELD f, in long power) raises (SALOME::SALOME_Exception);
/*! Linear transformation of the field f (factor*f+offset) */
FIELD lin(in FIELD f, in double factor, in double offset) raises (SALOME::SALOME_Exception);
- /*! Dublication of the field f */
+ /*! Duplication of the field f */
FIELD dup(in FIELD f) raises (SALOME::SALOME_Exception);
Cette interface est implémentée dans la classe C++ ``MEDOP_i`` du
import VISU
visuComp = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU")
- visuComp.SetCurrentStudy(salome.myStudy)
# Then we can import the specified field in the VISU module. This
# creates an study entry in the VISU folder.
-#!/usr/bin/env python
-# -*- coding: iso-8859-1 -*-
+#!/usr/bin/env python3
# Copyright (C) 2011-2016 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# as a field in a med file.
# (gboulant - 27/06/2011)
+import os
+
import MEDCoupling as MC
import MEDLoader as ML
#image = scipy.lena()
# We could either read a real image using the PIL python package.
from scipy.misc import pilutil
-image = pilutil.imread("images/avatar.png",True)
+CURDIR = os.path.dirname(__file__)
+image = pilutil.imread(os.path.join(CURDIR, "images", "avatar.png"),True)
#from PIL import Image
#im=Image.open("images/lena.png")
#image=pilutil.fromimage(im,True)
#image=numpy.asarray(im)
-#print image
+# print(image)
dim = len(image.shape)
-print "Image space dimension = %d"%dim
+print("Image space dimension = %d"%dim)
sizeX = image.shape[1]
sizeY = image.shape[0]
# double as required by the MEDCoupling field specification.
import numpy
imageDataNArray = image.reshape(1,sizeX*sizeY)[0]
-print imageDataNArray
+print(imageDataNArray)
imageDataNArrayDouble = numpy.array(imageDataNArray, dtype='float64')
imageDataArrayDouble = list(imageDataNArrayDouble)
coordsY.setValues(arrY,nbNodesY,1)
cmesh.setCoords(coordsX,coordsY)
-print "Imagem mesh dimension: %d"%cmesh.getSpaceDimension()
+print("Imagem mesh dimension: %d"%cmesh.getSpaceDimension())
# WARN: In the current state of development of MEDLoader, only
- # unstructured meshes are supported for writting function in med
+ # unstructured meshes are supported for writing function in med
# files. We just have to convert the cartesian mesh in an unstructured
# mesh before creating the field.
umesh=cmesh.buildUnstructured();
-#!/usr/bin/env python
-# -*- coding: iso-8859-1 -*-
+#!/usr/bin/env python3
# Copyright (C) 2011-2016 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
nbNodesX = sizeX+1
stepX = 0.1
arrX = [float(i * stepX) for i in range(nbNodesX)]
-print "Size of arrX = %d"%len(arrX)
+print("Size of arrX = %d"%len(arrX))
coordsX=MC.DataArrayDouble.New()
coordsX.setValues(arrX,nbNodesX,1)
coordsY.setValues(arrY,sizeY,1)
cmesh.setCoords(coordsX,coordsY)
-print cmesh.getSpaceDimension()
-#print cmesh
+print(cmesh.getSpaceDimension())
+# print(cmesh)
# WARN: In the current state of development of MEDLoader, only
- # unstructured meshes are supported for writting function in med
+ # unstructured meshes are supported for writing function in med
# files. We just have to convert the cartesian mesh in an unstructured
# mesh before creating the field.
umesh=cmesh.buildUnstructured();
# Get the data
imgdata=imgbw.getdata()
width,height=imgbw.size
- print list(imgdata)
- print width,height
+ print(list(imgdata))
+ print(width,height)
# Convert the data in a matrix using numpy
tab=numpy.array(imgdata,dtype='float64')
- print list(tab)
- print tab
+ print(list(tab))
+ print(tab)
nbRows=height
nbCols=width
matrix=numpy.reshape(tab,(nbRows,nbCols))
# Note that in the reshape function, the height (sizeY) of the image
# is specified first, because it corresponds to the number of rows.
- print matrix
- print list(matrix)
+ print(matrix)
+ print(list(matrix))
import MEDCoupling as MC
import MEDLoader as ML
coordsY.setValues(arrY,nbNodesY,1)
cmesh.setCoords(coordsX,coordsY)
- print "Imagem mesh dimension: %d"%cmesh.getSpaceDimension()
+ print("Imagem mesh dimension: %d"%cmesh.getSpaceDimension())
# WARN: In the current state of development of MEDLoader, only
- # unstructured meshes are supported for writting function in med
+ # unstructured meshes are supported for writing function in med
# files. We just have to convert the cartesian mesh in an unstructured
# mesh before creating the field.
umesh=cmesh.buildUnstructured();
#ifndef _WORKSPACE_CONTROLLER_HXX
#define _WORKSPACE_CONTROLLER_HXX
-#include "TreeGuiManager.hxx"
#include "MEDEventListener_i.hxx"
+#include "TreeGuiManager.hxx"
#include "XmedConsoleDriver.hxx"
#include "DatasourceController.hxx"
#include "PresentationController.hxx"
XmedConsoleDriver* getConsoleDriver() { return _consoleDriver; }
public slots:
- // Slots overiding TreeGuiManager
+ // Slots overriding TreeGuiManager
void processItemList(QStringList itemNameIdList, int actionId);
// Internal slots
coordsY.setValues(arrY,nbNodesY,1)
cmesh.setCoords(coordsX,coordsY)
- print "Imagem mesh dimension: %d"%cmesh.getSpaceDimension()
+ print("Imagem mesh dimension: %d"%cmesh.getSpaceDimension())
# WARN: In the current state of development of MEDLoader, only
- # unstructured meshes are supported for writting function in med
+ # unstructured meshes are supported for writing function in med
# files. We just have to convert the cartesian mesh in an unstructured
# mesh before creating the field.
umesh=cmesh.buildUnstructured();
if(!PySlice_Check(obj))
throw INTERP_KERNEL::Exception(msg);
Py_ssize_t strt,stp,step;
- PySliceObject *oC=reinterpret_cast<PySliceObject *>(obj);
- PySlice_GetIndices(oC,std::numeric_limits<int>::max(),&strt,&stp,&step);
+ PySlice_GetIndices(obj,std::numeric_limits<int>::max(),&strt,&stp,&step);
if(strt!=0 || stp!=std::numeric_limits<int>::max() || step!=1)
throw INTERP_KERNEL::Exception(msg);
tr.setAll(); pr.setAll(); cr.setAll();
convertPyObjToRS2(obj2,cr,"for 3rd tuple element for components of field");
}
MCAuto<MEDCalculatorDBFieldReal> ret=self->operator()(tr,pr,cr);
- if(PyInt_Check(val))
+ if(PyLong_Check(val))
{
- (*ret)=double(PyInt_AS_LONG(val));
+ (*ret)=double(PyLong_AS_LONG(val));
ret->incrRef();
return ret;
}
def MEDCouplingDataArrayIntTupleImod(self,*args):
import _MEDCalculator
return _MEDCalculator.DataArrayIntTuple____imod___(self, self, *args)
- def ParaMEDMEMDenseMatrixIadd(self,*args):
+ def MEDCouplingDenseMatrixIadd(self,*args):
import _MEDCalculator
return _MEDCalculator.DenseMatrix____iadd___(self, self, *args)
- def ParaMEDMEMDenseMatrixIsub(self,*args):
+ def MEDCouplingDenseMatrixIsub(self,*args):
import _MEDCalculator
return _MEDCalculator.DenseMatrix____isub___(self, self, *args)
%}
%include "MEDCouplingFinalize.i"
%pythoncode %{
+MEDCalculatorDBFieldReal.__rtruediv__ = MEDCalculatorDBFieldReal.__rdiv__
def MEDCouplingMEDFileUMeshReduce(self):
return MEDCouplingStdReduceFunct,(MEDFileUMesh,((),(self.__getstate__()),))
MEDFileUMesh.__reduce__=MEDCouplingMEDFileUMeshReduce
%nodefaultctor;
%nodefaultdtor;
+%{
+#if PY_VERSION_HEX < 0x03050000
+static char*
+Py_EncodeLocale(const wchar_t *text, size_t *error_pos)
+{
+ return _Py_wchar2char(text, error_pos);
+}
+#endif
+%}
+
namespace MEDCoupling
{
class MEDCouplingFieldDoubleClient
PyObject *iorField=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",fieldPtr);
if(!iorField)
throw INTERP_KERNEL::Exception("Error : the input parameter of MEDCouplingFieldDoubleClient.New appears to differ from CORBA reference ! Expecting a FieldDouble CORBA reference !");
- char *ior=PyString_AsString(iorField);
+ char *ior=Py_EncodeLocale(PyUnicode_AS_UNICODE(iorField), NULL);
int argc=0;
CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
CORBA::Object_var fieldPtrCpp=orb->string_to_object(ior);
PyObject *iorField=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",fieldPtr);
if(!iorField)
throw INTERP_KERNEL::Exception("Error : the input parameter of MEDCouplingFieldTemplateClient.New appears to differ from CORBA reference ! Expecting a FieldTemplate CORBA reference !");
- char *ior=PyString_AsString(iorField);
+ char *ior=Py_EncodeLocale(PyUnicode_AS_UNICODE(iorField), NULL);
int argc=0;
CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
CORBA::Object_var fieldPtrCpp=orb->string_to_object(ior);
PyObject *iorField=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",fieldPtr);
if(!iorField)
throw INTERP_KERNEL::Exception("Error : the input parameter of MEDCouplingFieldTemplateClient.New appears to differ from CORBA reference ! Expecting a MultiFields CORBA reference !");
- char *ior=PyString_AsString(iorField);
+ char *ior=Py_EncodeLocale(PyUnicode_AS_UNICODE(iorField), NULL);
int argc=0;
CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
CORBA::Object_var fieldPtrCpp=orb->string_to_object(ior);
PyObject *iorField=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",fieldPtr);
if(!iorField)
throw INTERP_KERNEL::Exception("Error : the input parameter of MEDCouplingFieldOverTimeClient.New appears to differ from CORBA reference ! Expecting a FieldOverTime CORBA reference !");
- char *ior=PyString_AsString(iorField);
+ char *ior=Py_EncodeLocale(PyUnicode_AS_UNICODE(iorField), NULL);
int argc=0;
CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
CORBA::Object_var fieldPtrCpp=orb->string_to_object(ior);
PyObject *iorMesh=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",meshPtr);
if(!iorMesh)
throw INTERP_KERNEL::Exception("Error : the input parameter of MEDCouplingMeshClient.New appears to differ from CORBA reference ! Expecting a MeshCorbaInterface CORBA reference !");
- char *ior=PyString_AsString(iorMesh);
+ char *ior=Py_EncodeLocale(PyUnicode_AS_UNICODE(iorMesh), NULL);
int argc=0;
CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
CORBA::Object_var meshPtrCpp=orb->string_to_object(ior);
PyObject *iorMesh=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",meshPtr);
if(!iorMesh)
throw INTERP_KERNEL::Exception("Error : the input parameter of MEDCouplingUMeshClient.New appears to differ from CORBA reference ! Expecting a UMeshCorbaInterface CORBA reference !");
- char *ior=PyString_AsString(iorMesh);
+ char *ior=Py_EncodeLocale(PyUnicode_AS_UNICODE(iorMesh), NULL);
int argc=0;
CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
CORBA::Object_var meshPtrCpp=orb->string_to_object(ior);
PyObject *iorMesh=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",meshPtr);
if(!iorMesh)
throw INTERP_KERNEL::Exception("Error : the input parameter of MEDCoupling1SGTUMeshClient.New appears to differ from CORBA reference ! Expecting a 1SGTUMeshCorbaInterface CORBA reference !");
- char *ior=PyString_AsString(iorMesh);
+ char *ior=Py_EncodeLocale(PyUnicode_AS_UNICODE(iorMesh), NULL);
int argc=0;
CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
CORBA::Object_var meshPtrCpp=orb->string_to_object(ior);
PyObject *iorMesh=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",meshPtr);
if(!iorMesh)
throw INTERP_KERNEL::Exception("Error : the input parameter of MEDCoupling1DGTUMeshClient.New appears to differ from CORBA reference ! Expecting a 1DGTUMeshCorbaInterface CORBA reference !");
- char *ior=PyString_AsString(iorMesh);
+ char *ior=Py_EncodeLocale(PyUnicode_AS_UNICODE(iorMesh), NULL);
int argc=0;
CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
CORBA::Object_var meshPtrCpp=orb->string_to_object(ior);
PyObject *iorMesh=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",meshPtr);
if(!iorMesh)
throw INTERP_KERNEL::Exception("Error : the input parameter of MEDCouplingExtrudedMeshClient.New appears to differ from CORBA reference ! Expecting an ExtrudedMeshCorbaInterface CORBA reference !");
- char *ior=PyString_AsString(iorMesh);
+ char *ior=Py_EncodeLocale(PyUnicode_AS_UNICODE(iorMesh), NULL);
int argc=0;
CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
CORBA::Object_var meshPtrCpp=orb->string_to_object(ior);
PyObject *iorMesh=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",meshPtr);
if(!iorMesh)
throw INTERP_KERNEL::Exception("Error : the input parameter of MEDCouplingCMeshClient.New appears to differ from CORBA reference ! Expecting a CMeshCorbaInterface CORBA reference !");
- char *ior=PyString_AsString(iorMesh);
+ char *ior=Py_EncodeLocale(PyUnicode_AS_UNICODE(iorMesh), NULL);
int argc=0;
CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
CORBA::Object_var meshPtrCpp=orb->string_to_object(ior);
PyObject *iorMesh=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",meshPtr);
if(!iorMesh)
throw INTERP_KERNEL::Exception("Error : the input parameter of MEDCouplingIMeshClient.New appears to differ from CORBA reference ! Expecting a IMeshCorbaInterface CORBA reference !");
- char *ior=PyString_AsString(iorMesh);
+ char *ior=Py_EncodeLocale(PyUnicode_AS_UNICODE(iorMesh), NULL);
int argc=0;
CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
CORBA::Object_var meshPtrCpp=orb->string_to_object(ior);
PyObject *iorMesh=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",meshPtr);
if(!iorMesh)
throw INTERP_KERNEL::Exception("Error : the input parameter of MEDCouplingCurveLinearMeshClient.New appears to differ from CORBA reference ! Expecting a CurveLinearMeshCorbaInterface CORBA reference !");
- char *ior=PyString_AsString(iorMesh);
+ char *ior=Py_EncodeLocale(PyUnicode_AS_UNICODE(iorMesh), NULL);
int argc=0;
CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
CORBA::Object_var meshPtrCpp=orb->string_to_object(ior);
PyObject *iorMesh=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",meshPtr);
if(!iorMesh)
throw INTERP_KERNEL::Exception("Error : the input parameter of DataArrayDoubleClient.New appears to differ from CORBA reference ! Expecting a DataArrayDoubleCorbaInterface CORBA reference !");
- char *ior=PyString_AsString(iorMesh);
+ char *ior=Py_EncodeLocale(PyUnicode_AS_UNICODE(iorMesh), NULL);
int argc=0;
CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
CORBA::Object_var meshPtrCpp=orb->string_to_object(ior);
PyObject *iorMesh=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",meshPtr);
if(!iorMesh)
throw INTERP_KERNEL::Exception("Error : the input parameter of DataArrayIntClient.New appears to differ from CORBA reference ! Expecting a DataArrayIntCorbaInterface CORBA reference !");
- char *ior=PyString_AsString(iorMesh);
+ char *ior=Py_EncodeLocale(PyUnicode_AS_UNICODE(iorMesh), NULL);
int argc=0;
CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
CORBA::Object_var meshPtrCpp=orb->string_to_object(ior);
def MEDCouplingDataArrayIntTupleImod(self,*args):
import _MEDCouplingClient
return _MEDCouplingClient.DataArrayIntTuple____imod___(self, self, *args)
- def ParaMEDMEMDenseMatrixIadd(self,*args):
+ def MEDCouplingDenseMatrixIadd(self,*args):
import _MEDCouplingClient
return _MEDCouplingClient.DenseMatrix____iadd___(self, self, *args)
- def ParaMEDMEMDenseMatrixIsub(self,*args):
+ def MEDCouplingDenseMatrixIsub(self,*args):
import _MEDCouplingClient
return _MEDCouplingClient.DenseMatrix____isub___(self, self, *args)
%}