Exemple #1
0
 def test_copy(self):
     l1 = IntVector( default_value = 77 )
     l1[99] = 100
     
     l2 = l1.copy()
     self.assertTrue( l1.default == l2.default )
     self.assertTrue( len(l1) == len(l2))
     self.assertTrue( l1[99] == l2[99] )
Exemple #2
0
 def test_activeList(self):
     active_list = IntVector.active_list("1,10,100-105")
     self.assertTrue( len(active_list) == 8 )
     self.assertTrue( active_list[0] == 1)
     self.assertTrue( active_list[2] == 100)
     self.assertTrue( active_list[7] == 105)
     
     active_list = IntVector.active_list("1,10,100-105X")
     self.assertFalse( active_list )
Exemple #3
0
    def test_activeList(self):
        active_list = IntVector.active_list("1,10,100-105")
        self.assertTrue(len(active_list) == 8)
        self.assertTrue(active_list[0] == 1)
        self.assertTrue(active_list[2] == 100)
        self.assertTrue(active_list[7] == 105)

        active_list = IntVector.active_list("1,10,100-105X")
        self.assertFalse(active_list)
Exemple #4
0
    def test_default(self):
        l = IntVector( default_value = 100 )
        self.assertTrue( l.default == 100 )
        l[10] = 1
        self.assertTrue( l[0]  == 100 )
        self.assertTrue( l[9]  == 100 )
        self.assertTrue( l[10] == 1 )

        l.default = 200
        self.assertTrue( l.default == 200 )
        l[20] = 77
        self.assertTrue( l[19] == 200 )
Exemple #5
0
 def global_list(self):
     """
     IntVector instance with global indices in the region.
     """
     c_ptr = cfunc.get_global_list(self)
     global_list = IntVector.ref(c_ptr, self)
     return global_list
Exemple #6
0
 def active_list(self):
     """
     IntVector instance with active indices in the region.
     """
     c_ptr = cfunc.get_active_list(self)
     active_list = IntVector.ref(c_ptr, self)
     return active_list
Exemple #7
0
 def global_list(self):
     """
     IntVector instance with global indices in the region.
     """
     c_ptr = cfunc.get_global_list( self )
     global_list = IntVector.ref( c_ptr , self )    
     return global_list
Exemple #8
0
 def active_list(self):
     """
     IntVector instance with active indices in the region.
     """
     c_ptr = cfunc.get_active_list( self )
     active_list = IntVector.ref( c_ptr , self )
     return active_list
Exemple #9
0
 def test_true(self):
     l = IntVector()
     self.assertFalse(
         l
     )  # Will invoke the __len__ function; could override with __nonzero__
     l[0] = 1
     self.assertTrue(l)
Exemple #10
0
print stat.quantile_sorted(v, 0.20)
print stat.quantile_sorted(v, 0.30)
print stat.quantile_sorted(v, 0.40)
print stat.quantile_sorted(v, 0.50)

a = v[0:10]
print a
print a[6]
print a

b = copy.deepcopy(a)
c = a.copy()
print c
print b
print v
c = IntVector(0)
c.append(1)
c.append(2)
c.append(3)
c.append(4)
c.append(5)

c.rsort()
c.printf()

print c.max
print c.min
print c.min_index()
c[4] = 5
print c.max_index(reverse=True)
print c.max_index(reverse=False)
Exemple #11
0
 def kw_index_list(self, ecl_kw, force_active):
     c_ptr = cfunc.get_kw_index_list(self, ecl_kw, force_active)
     index_list = IntVector.ref(c_ptr, self)
     return index_list
Exemple #12
0
 def kw_index_list(self , ecl_kw , force_active):
     c_ptr = cfunc.get_kw_index_list( self , ecl_kw , force_active)
     index_list = IntVector.ref( c_ptr , self )
     return index_list
Exemple #13
0
print stat.quantile_sorted( v , 0.30 )
print stat.quantile_sorted( v , 0.40 )
print stat.quantile_sorted( v , 0.50 )

a = v[0:10]
print a
print a[6]
print a


b = copy.deepcopy( a )
c = a.copy(  )
print c
print b
print v
c = IntVector( 0 )
c.append( 1 )
c.append( 2 )
c.append( 3 )
c.append( 4 )
c.append( 5 )

c.rsort()
c.printf()

print c.max
print c.min
print c.min_index()
c[4] = 5
print c.max_index( reverse = True )
print c.max_index( reverse = False )