~corrado-maurini/dolfin/tao

« back to all changes in this revision

Viewing changes to test/unit/fem/python/Assembler.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:
31
31
 
32
32
    def test_cell_assembly_1D(self):
33
33
 
34
 
        mesh = UnitInterval(48)
 
34
        mesh = UnitIntervalMesh(48)
35
35
        V = FunctionSpace(mesh, "CG", 1)
36
36
 
37
37
        v = TestFunction(V)
58
58
 
59
59
    def test_cell_assembly(self):
60
60
 
61
 
        mesh = UnitCube(4, 4, 4)
 
61
        mesh = UnitCubeMesh(4, 4, 4)
62
62
        V = VectorFunctionSpace(mesh, "DG", 1)
63
63
 
64
64
        v = TestFunction(V)
92
92
            print "FIXME: This unit test does not work in parallel, skipping"
93
93
            return
94
94
 
95
 
        mesh = UnitSquare(24, 24)
 
95
        mesh = UnitSquareMesh(24, 24)
96
96
        V = FunctionSpace(mesh, "DG", 1)
97
97
 
98
98
        # Define test and trial functions
135
135
 
136
136
    def test_functional_assembly(self):
137
137
 
138
 
        mesh = UnitSquare(24, 24)
 
138
        mesh = UnitSquareMesh(24, 24)
139
139
 
140
140
        # This is a hack to get around a DOLFIN bug
141
141
        if MPI.num_processes() > 1:
159
159
        "Test assembly over subdomains with markers stored as part of mesh"
160
160
 
161
161
        # Create a mesh of the unit cube
162
 
        mesh = UnitCube(4, 4, 4)
 
162
        mesh = UnitCubeMesh(4, 4, 4)
163
163
 
164
164
        # Define subdomains for 3 faces of the unit cube
165
165
        class F0(SubDomain):
215
215
            return
216
216
 
217
217
        # Define some haphazardly chosen cell/facet function
218
 
        mesh = UnitSquare(4, 4)
219
 
        domains = CellFunction("uint", mesh)
 
218
        mesh = UnitSquareMesh(4, 4)
 
219
        domains = CellFunction("size_t", mesh)
220
220
        domains.set_all(0)
221
221
        domains[0] = 1
222
222
        domains[1] = 1
223
223
 
224
 
        boundaries = FacetFunction("uint", mesh)
 
224
        boundaries = FacetFunction("size_t", mesh)
225
225
        boundaries.set_all(0)
226
226
        boundaries[0] = 1
227
227
        boundaries[1] = 1
250
250
            parameters["num_threads"] = 0
251
251
 
252
252
        # Check that given exterior_facet_domains override
253
 
        new_boundaries = FacetFunction("uint", mesh)
 
253
        new_boundaries = FacetFunction("size_t", mesh)
254
254
        new_boundaries.set_all(0)
255
255
        reference2 = 6.2001953125
256
256
        value2 = assemble(M, exterior_facet_domains=new_boundaries)
293
293
        "Test assembly over subdomains with markers stored as part of form"
294
294
 
295
295
        # Define mesh
296
 
        mesh = UnitSquare(8, 8)
 
296
        mesh = UnitSquareMesh(8, 8)
297
297
 
298
298
        # Define domain for lower left corner
299
299
        class MyDomain(SubDomain):
310
310
 
311
311
        # Mark mesh functions
312
312
        D = mesh.topology().dim()
313
 
        cell_domains = MeshFunction("uint", mesh, D)
314
 
        exterior_facet_domains = MeshFunction("uint", mesh, D - 1)
 
313
        cell_domains = MeshFunction("size_t", mesh, D)
 
314
        exterior_facet_domains = MeshFunction("size_t", mesh, D - 1)
315
315
        cell_domains.set_all(1)
316
316
        exterior_facet_domains.set_all(1)
317
317
        my_domain.mark(cell_domains, 0)
335
335
            return
336
336
 
337
337
        # Create mesh, then color and renumber
338
 
        old_mesh = UnitCube(4, 4, 4)
 
338
        old_mesh = UnitCubeMesh(4, 4, 4)
339
339
        old_mesh.color("vertex")
340
340
        mesh = old_mesh.renumber_by_color()
341
341
 
364
364
    def test_nonsquare_assembly(self):
365
365
        """Test assembly of a rectangular matrix"""
366
366
 
367
 
        mesh = UnitSquare(16, 16)
 
367
        mesh = UnitSquareMesh(16, 16)
368
368
 
369
369
        V = VectorFunctionSpace(mesh, "CG", 2)
370
370
        Q = FunctionSpace(mesh, "CG", 1)
407
407
 
408
408
            # Create reference matrices and set entries
409
409
            A0, M0 = uBLASDenseMatrix(4, 4), uBLASDenseMatrix(4, 4)
410
 
            pos = numpy.array([0, 1, 2, 3], dtype=numpy.uintc)
 
410
            pos = numpy.array([0, 1, 2, 3], dtype=numpy.intc)
411
411
            A0.set(numpy.array([[1.0/2.0, -1.0/6.0, -1.0/6.0, -1.0/6.0],
412
412
                          [-1.0/6.0, 1.0/6.0, 0.0, 0.0],
413
413
                          [-1.0/6.0, 0.0, 1.0/6.0, 0.0],