Salome HOME
53d39c3ef9b1184311ec44650050b41dee7faba8
[samples/pycalculator.git] / src / PYCALCULATOR / PYCALCULATOR_TEST.py
1 # Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
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.
10 #
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.
15 #
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
19 #
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22
23 #============================================================================
24 # File   : PYCALCULATOR_TEST.py
25 # Author : Vadim SANDLER, OPEN CASCADE S.A.S. (vadim.sandler@opencascade.com)
26 #============================================================================
27
28 import os
29
30 import salome
31 salome.salome_init()
32
33 import PYCALCULATOR_ORB
34
35 from MEDCouplingCorba import *
36 from MEDCoupling import *
37 from MEDLoader import *
38
39 pc = salome.lcc.FindOrLoadComponent('FactoryServer','PYCALCULATOR')
40
41 medFile   = os.path.join(os.getenv("MED_ROOT_DIR"), "share/salome/resources/med/pointe.med")
42 meshName  = "maa1"
43 fieldName = "fieldcelldoublevector"
44 print medFile, meshName, fieldName
45
46 f = MEDLoader.ReadFieldCell(medFile, meshName, 0, fieldName, -1, -1)
47 forig = MEDCouplingFieldDoubleServant._this(f)
48
49 fcopy = pc.Clone(forig)
50 f1    = pc.Add(forig, fcopy)
51 f2    = pc.Mul(forig, fcopy)
52 f3    = pc.AddConstant(forig, 3.5)
53 f4    = pc.MulConstant(forig, 3.5)