def test_empty_faultLine(self): fl = FaultLine(self.grid , 10) self.assertEqual( 10 , fl.getK()) self.assertEqual( 0 , len(fl) ) with self.assertRaises(TypeError): f = fl[ "Test" ] with self.assertRaises(IndexError): f = fl[0]
def test_faultLine_center(self): nx = 10 ny = 10 nz = 2 grid = EclGrid.createRectangular( (nx,ny,nz) , (0.1,0.1,0.1)) fl = FaultLine(grid , 0) C1 = (nx + 1) * 5 + 3 C2 = C1 + 2 C3 = C2 + 2 s1 = FaultSegment( C1 , C2 ) s2 = FaultSegment( C2 , C3 ) fl.tryAppend( s1 ) fl.tryAppend( s2 ) self.assertEqual( len(fl) , 2 ) self.assertEqual( fl.center() , (0.50 , 0.50) )
def test_faultLine_center(self): nx = 10 ny = 10 nz = 2 grid = EclGrid.create_rectangular( (nx,ny,nz) , (0.1,0.1,0.1)) fl = FaultLine(grid , 0) C1 = (nx + 1) * 5 + 3 C2 = C1 + 2 C3 = C2 + 2 s1 = FaultSegment( C1 , C2 ) s2 = FaultSegment( C2 , C3 ) fl.tryAppend( s1 ) fl.tryAppend( s2 ) self.assertEqual( len(fl) , 2 ) self.assertEqual( fl.center() , (0.50 , 0.50) )
def test_faultLine(self): fl = FaultLine(self.grid , 10) S1 = FaultSegment(0 , 10) S2 = FaultSegment(10 , 20) fl.tryAppend( S1 ) fl.tryAppend( S2 ) fl.verify() S3 = FaultSegment(20 , 30) fl.tryAppend( S3 ) fl.verify() #--- fl = FaultLine(self.grid , 10) S1 = FaultSegment(0 , 10) S2 = FaultSegment(20 , 10) fl.tryAppend( S1 ) self.assertTrue( fl.tryAppend( S2 ) ) fl.verify() #--- fl = FaultLine(self.grid , 10) S1 = FaultSegment(10 , 0) S2 = FaultSegment(20 , 10) fl.tryAppend( S1 ) fl.tryAppend( S2 ) fl.verify() #--- fl = FaultLine(self.grid , 10) S1 = FaultSegment(10 , 0) S2 = FaultSegment(10 , 20) fl.tryAppend( S1 ) fl.tryAppend( S2 ) fl.verify() fl = FaultLine(self.grid , 10) S1 = FaultSegment(10 , 0) S2 = FaultSegment(10 , 20) fl.tryAppend( S1 ) fl.tryAppend( S2 ) S3 = FaultSegment(40 , 30) self.assertTrue( fl.tryAppend(S3) == False ) self.assertEqual( len(fl) , 2 ) pl = fl.getPolyline( ) self.assertIsInstance( pl , CPolyline ) self.assertEqual( len(pl) , len(fl) + 1 ) S3 = FaultSegment(20 , 30) fl.tryAppend( S3 ) pl = fl.getPolyline( ) self.assertIsInstance( pl , CPolyline ) self.assertEqual( len(pl) , len(fl) + 1 )