~corrado-maurini/dolfin/tao

« back to all changes in this revision

Viewing changes to test/unit/la/python/Vector.py

  • Committer: corrado maurini
  • Date: 2012-12-18 12:16:08 UTC
  • mfrom: (6685.78.207 trunk)
  • Revision ID: corrado.maurini@upmc.fr-20121218121608-nk82ly9jgsld9u84
updating with trunk, fix uint in TAO solver and hacking the check for tao FindTAO.cmake

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
            print "\nRunning:",type(self).__name__
38
38
 
39
39
    def assemble_vectors(self):
40
 
        mesh = UnitSquare(7, 4)
 
40
        mesh = UnitSquareMesh(7, 4)
41
41
 
42
42
        V = FunctionSpace(mesh, "Lagrange", 2)
43
43
        W = FunctionSpace(mesh, "Lagrange", 1)
207
207
        n = 301
208
208
        v0 = Vector(n)
209
209
        v0[:] = -2.0
210
 
        entries = zeros(5, dtype='I')
 
210
        entries = zeros(5, dtype='uintp')
211
211
        self.assertEqual(v0.sum(entries), -2.0)
212
212
        entries[0] = 2
213
213
        entries[1] = 1
318
318
 
319
319
 
320
320
# A DataTester class that test the acces of the raw data through pointers
321
 
# This is only available for uBLAS and MTL4 backends
 
321
# This is only available for uBLAS backend
322
322
class DataTester:
323
323
    def test_vector_data(self):
324
324
        # Test for ordinary Vector
338
338
        data = v.data()
339
339
        self.assertTrue((data==array).all())
340
340
 
341
 
 
342
341
class DataNotWorkingTester:
343
342
    def test_vector_data(self):
344
343
        v = Vector(301)
358
357
        backend     = "uBLAS"
359
358
        sub_backend = "Dense"
360
359
 
361
 
    if has_linear_algebra_backend("MTL4"):
362
 
        class MTL4Tester(DataTester, AbstractBaseTest, unittest.TestCase):
363
 
            backend    = "MTL4"
364
 
 
365
360
    if has_linear_algebra_backend("PETScCusp"):
366
361
        class PETScCuspTester(DataNotWorkingTester, AbstractBaseTest, unittest.TestCase):
367
362
            backend    = "PETScCusp"
374
369
    class EpetraTester(DataNotWorkingTester, AbstractBaseTest, unittest.TestCase):
375
370
        backend    = "Epetra"
376
371
 
377
 
class STLTester(DataNotWorkingTester, AbstractBaseTest, unittest.TestCase):
378
 
    backend    = "STL"
 
372
# If we have PETSc or Epetra STL Vector gets typedefed to one of these and
 
373
# data test will not work. If none of these backends are available
 
374
# STLVector defaults to uBLASVEctor, which data will work
 
375
if has_linear_algebra_backend("Epetra") or has_linear_algebra_backend("PETSc"):
 
376
    class STLTester(DataNotWorkingTester, AbstractBaseTest, unittest.TestCase):
 
377
        backend    = "STL"
 
378
else:
 
379
    class STLTester(AbstractBaseTest, unittest.TestCase):
 
380
        backend    = "STL"
379
381
 
380
382
if __name__ == "__main__":
381
383