1 # Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 # Copyright (C) 2003-2007 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, or (at your option) any later version.
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 #============================================================================
24 # File : PYCALCULATOR_TEST.py
25 # Author : Vadim SANDLER, OPEN CASCADE S.A.S. (vadim.sandler@opencascade.com)
26 #============================================================================
33 import PYCALCULATOR_ORB
35 from MEDCouplingCorba import *
36 from MEDCoupling import *
37 from MEDLoader import *
38 from MEDCouplingClient import *
40 pc = salome.lcc.FindOrLoadComponent('FactoryServer','PYCALCULATOR')
42 medFile = os.path.join(os.getenv("DATA_DIR"), "MedFiles", "pointe.med")
44 fieldName = "fieldcelldoublevector"
45 print medFile, meshName, fieldName
47 f = ReadFieldCell(medFile, meshName, 0, fieldName, -1, -1)
48 forig = MEDCouplingFieldDoubleServant._this(f)
50 fcopy = pc.Clone(forig)
51 f1 = pc.Add(forig, fcopy)
52 f2 = pc.Mul(forig, fcopy)
53 f3 = pc.AddConstant(forig, 3.5)
54 f4 = pc.MulConstant(forig, 3.5)
56 clt_forig = MEDCouplingFieldDoubleClient.New(forig)
57 clt_fcopy = MEDCouplingFieldDoubleClient.New(fcopy)
58 clt_f1 = MEDCouplingFieldDoubleClient.New(f1)
59 clt_f2 = MEDCouplingFieldDoubleClient.New(f2)
60 clt_f3 = MEDCouplingFieldDoubleClient.New(f3)
61 clt_f4 = MEDCouplingFieldDoubleClient.New(f4)
63 print "clt_forig:", clt_forig
64 print "clt_fcopy:", clt_fcopy
65 print "clt_f1:", clt_f1
66 print "clt_f2:", clt_f2
67 print "clt_f3:", clt_f3
68 print "clt_f4:", clt_f4