Salome HOME
Addition of new reference coords including degenerated cells.
[modules/med.git] / src / MEDCouplingCorba_Swig / MEDCouplingCorbaSwigTest.py
index cdce36bbd1ea076e65cb344ecc01d8d08c66da6c..01289cf51e0a36b5fb9f418062aac6c2fbae84e5 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2012  CEA/DEN, EDF R&D
+# Copyright (C) 2007-2013  CEA/DEN, EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -168,13 +168,59 @@ class MEDCouplingCorbaServBasicsTest:
         a2.setInfoOnComponent(0,"SmthZ");
         #
         targetMesh.setCoordsAt(0,a1);
-        targetMesh.setCoordsAt(2,a2);
+        targetMesh.setCoordsAt(1,a2);
         #
         #
         targetMesh.checkCoherency();
         #
         return targetMesh;
 
+    def buildCLMesh(self):
+        targetMesh=MEDCouplingCurveLinearMesh();
+        targetMesh.setTime(2.3,4,5);
+        targetMesh.setTimeUnit("us");
+        targetMesh.setName("Example of Cuve linear mesh");
+        targetMesh.setDescription("buildCLMesh");
+        a1=DataArrayDouble(3*20,1);
+        a1.iota(7.) ; a1.rearrange(3);
+        targetMesh.setCoords(a1);
+        targetMesh.setNodeGridStructure([4,5]);
+        #
+        targetMesh.checkCoherency();
+        #
+        return targetMesh;
+
+    def build1SGTUMesh(self):
+        targetMesh=MEDCoupling1SGTUMesh("Mesh1SGT",NORM_QUAD4)
+        targetMesh.setTime(2.3,44,-55)
+        targetMesh.setTimeUnit("us")
+        targetMesh.setDescription("My Description of 1SGTU");
+        a1=DataArrayDouble([1.,1.,0.,2.,1.,0.,3.,1.,0.,1.,0.,0.,2.,0.,0.,0.,0.,0.,0.,1.,0.,3.,0.,0.,4.,0.,0.,4.,1.,0.],10,3)
+        a1.setInfoOnComponents(["X1 [m]","YY2 [km]","ZZZ3 [km]"])
+        targetMesh.setCoords(a1)
+        a2=DataArrayInt([6,0,3,5,3,0,1,4,1,2,7,4,8,7,2,9],4*4,1)
+        targetMesh.setNodalConnectivity(a2)
+        #
+        targetMesh.checkCoherency();
+        #
+        return targetMesh;
+
+    def build1DGTUMesh(self):
+        targetMesh=MEDCoupling1DGTUMesh("Mesh1DGT",NORM_POLYGON);
+        targetMesh.setTime(2.3,55,-66)
+        targetMesh.setTimeUnit("us")
+        targetMesh.setDescription("My Description of 1DGTU");
+        a1=DataArrayDouble([1.,1.,0.,2.,1.,0.,3.,1.,0.,1.,0.,0.,2.,0.,0.,0.,0.,0.,0.,1.,0.,3.,0.,0.,4.,0.,0.,4.,1.,0.],10,3)
+        a1.setInfoOnComponents(["X1 [m]","YY2 [km]","ZZZ3 [km]"])
+        targetMesh.setCoords(a1)
+        a2=DataArrayInt([6,0,3,5,3,0,1,4,1,2,7,4,8,7,2],15,1)
+        a3=DataArrayInt([0,4,8,12,15],5,1)
+        targetMesh.setNodalConnectivity(a2,a3)
+        #
+        targetMesh.checkCoherency();
+        #
+        return targetMesh;
+        
     def buildFieldScalarOn2DNT(self):
         mesh=self.build2DMesh();
         fieldOnCells=MEDCouplingFieldDouble.New(ON_CELLS,NO_TIME);
@@ -509,7 +555,7 @@ class MEDCouplingCorbaServBasicsTest:
         d0=DataArrayDouble.New();
         d0.setValues(vals0,5,1);
         d1=DataArrayDouble.New();
-        d1.setValues(vals1,5,1);
+        d1.setValues(vals1[:5],5,1);
         d1_1=DataArrayDouble.New();
         d1_1.setValues(vals1_1,5,1);
         d2=DataArrayDouble.New();
@@ -554,8 +600,13 @@ class MEDCouplingCorbaServBasicsTest:
         return ret;
 
     def buildFileNameForIOR(self):
-        ret=os.getenv("TMP");
-        ret+="/entryPointMEDCouplingCorba.ior";
+        tmpdir=os.getenv("TMP", "/tmp");
+        username="";
+        if os.getenv("USERNAME"):
+            username = os.getenv("USERNAME")+"_";
+        elif os.getenv("USER"):
+            username = os.getenv("USER")+"_";
+        ret=tmpdir+"/"+username+"entryPointMEDCouplingCorba.ior";
         return ret;
     pass