~ubuntu-branches/ubuntu/utopic/ffc/utopic

« back to all changes in this revision

Viewing changes to test/regression/references/r_quadrature_O/X_Element2.h

  • Committer: Package Import Robot
  • Author(s): Johannes Ring
  • Date: 2013-06-26 14:48:32 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20130626144832-1xd8htax4s3utybz
Tags: 1.2.0-1
* New upstream release.
* debian/control:
  - Bump required version for python-ufc, python-fiat, python-instant
    and python-ufl in Depends field.
  - Bump Standards-Version to 3.9.4.
  - Remove DM-Upload-Allowed field.
  - Bump required debhelper version in Build-Depends.
  - Remove cdbs from Build-Depends.
  - Use canonical URIs for Vcs-* fields.
* debian/compat: Bump to compatibility level 9.
* debian/rules: Rewrite for debhelper (drop cdbs).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// This code conforms with the UFC specification version 2.0.5
2
 
// and was automatically generated by FFC version 1.0.0.
 
1
// This code conforms with the UFC specification version 2.2.0
 
2
// and was automatically generated by FFC version 1.2.0.
3
3
// 
4
4
// This code was generated with the following parameters:
5
5
// 
52
52
  /// Return a string identifying the finite element
53
53
  virtual const char* signature() const
54
54
  {
55
 
    return "FiniteElement('Real', Cell('triangle', Space(2)), 0, None)";
 
55
    return "FiniteElement('Real', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 0, None)";
56
56
  }
57
57
 
58
58
  /// Return the cell shape
62
62
  }
63
63
 
64
64
  /// Return the topological dimension of the cell shape
65
 
  virtual unsigned int topological_dimension() const
 
65
  virtual std::size_t topological_dimension() const
66
66
  {
67
67
    return 2;
68
68
  }
69
69
 
70
70
  /// Return the geometric dimension of the cell shape
71
 
  virtual unsigned int geometric_dimension() const
 
71
  virtual std::size_t geometric_dimension() const
72
72
  {
73
73
    return 2;
74
74
  }
75
75
 
76
76
  /// Return the dimension of the finite element function space
77
 
  virtual unsigned int space_dimension() const
 
77
  virtual std::size_t space_dimension() const
78
78
  {
79
79
    return 1;
80
80
  }
81
81
 
82
82
  /// Return the rank of the value space
83
 
  virtual unsigned int value_rank() const
 
83
  virtual std::size_t value_rank() const
84
84
  {
85
85
    return 0;
86
86
  }
87
87
 
88
88
  /// Return the dimension of the value space for axis i
89
 
  virtual unsigned int value_dimension(unsigned int i) const
 
89
  virtual std::size_t value_dimension(std::size_t i) const
90
90
  {
91
91
    return 1;
92
92
  }
93
93
 
94
 
  /// Evaluate basis function i at given point in cell
95
 
  virtual void evaluate_basis(unsigned int i,
 
94
  /// Evaluate basis function i at given point x in cell
 
95
  virtual void evaluate_basis(std::size_t i,
96
96
                              double* values,
97
 
                              const double* coordinates,
98
 
                              const ufc::cell& c) const
 
97
                              const double* x,
 
98
                              const double* vertex_coordinates,
 
99
                              int cell_orientation) const
99
100
  {
100
 
    // Extract vertex coordinates
101
 
    
102
 
    // Compute Jacobian of affine map from reference cell
103
 
    
104
 
    // Compute determinant of Jacobian
105
 
    
106
 
    // Compute inverse of Jacobian
 
101
    // Compute Jacobian
 
102
    double J[4];
 
103
    compute_jacobian_triangle_2d(J, vertex_coordinates);
 
104
    
 
105
    // Compute Jacobian inverse and determinant
 
106
    double K[4];
 
107
    double detJ;
 
108
    compute_jacobian_inverse_triangle_2d(K, detJ, J);
 
109
    
107
110
    
108
111
    // Compute constants
109
112
    
110
113
    // Get coordinates and map to the reference (FIAT) element
111
114
    
112
 
    // Reset values.
 
115
    // Reset values
113
116
    *values = 0.0;
114
117
    
115
 
    // Array of basisvalues.
 
118
    // Array of basisvalues
116
119
    double basisvalues[1] = {0.0};
117
120
    
118
 
    // Declare helper variables.
 
121
    // Declare helper variables
119
122
    
120
 
    // Compute basisvalues.
 
123
    // Compute basisvalues
121
124
    basisvalues[0] = 1.0;
122
125
    
123
 
    // Table(s) of coefficients.
 
126
    // Table(s) of coefficients
124
127
    static const double coefficients0[1] = \
125
128
    {1.0};
126
129
    
127
 
    // Compute value(s).
 
130
    // Compute value(s)
128
131
    for (unsigned int r = 0; r < 1; r++)
129
132
    {
130
133
      *values += coefficients0[r]*basisvalues[r];
131
134
    }// end loop over 'r'
132
135
  }
133
136
 
134
 
  /// Evaluate all basis functions at given point in cell
 
137
  /// Evaluate all basis functions at given point x in cell
135
138
  virtual void evaluate_basis_all(double* values,
136
 
                                  const double* coordinates,
137
 
                                  const ufc::cell& c) const
 
139
                                  const double* x,
 
140
                                  const double* vertex_coordinates,
 
141
                                  int cell_orientation) const
138
142
  {
139
143
    // Element is constant, calling evaluate_basis.
140
 
    evaluate_basis(0, values, coordinates, c);
 
144
    evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
141
145
  }
142
146
 
143
 
  /// Evaluate order n derivatives of basis function i at given point in cell
144
 
  virtual void evaluate_basis_derivatives(unsigned int i,
145
 
                                          unsigned int n,
 
147
  /// Evaluate order n derivatives of basis function i at given point x in cell
 
148
  virtual void evaluate_basis_derivatives(std::size_t i,
 
149
                                          std::size_t n,
146
150
                                          double* values,
147
 
                                          const double* coordinates,
148
 
                                          const ufc::cell& c) const
 
151
                                          const double* x,
 
152
                                          const double* vertex_coordinates,
 
153
                                          int cell_orientation) const
149
154
  {
150
 
    // Extract vertex coordinates
151
 
    const double * const * x = c.coordinates;
152
 
    
153
 
    // Compute Jacobian of affine map from reference cell
154
 
    const double J_00 = x[1][0] - x[0][0];
155
 
    const double J_01 = x[2][0] - x[0][0];
156
 
    const double J_10 = x[1][1] - x[0][1];
157
 
    const double J_11 = x[2][1] - x[0][1];
158
 
    
159
 
    // Compute determinant of Jacobian
160
 
    double detJ = J_00*J_11 - J_01*J_10;
161
 
    
162
 
    // Compute inverse of Jacobian
163
 
    const double K_00 =  J_11 / detJ;
164
 
    const double K_01 = -J_01 / detJ;
165
 
    const double K_10 = -J_10 / detJ;
166
 
    const double K_11 =  J_00 / detJ;
 
155
    // Compute Jacobian
 
156
    double J[4];
 
157
    compute_jacobian_triangle_2d(J, vertex_coordinates);
 
158
    
 
159
    // Compute Jacobian inverse and determinant
 
160
    double K[4];
 
161
    double detJ;
 
162
    compute_jacobian_inverse_triangle_2d(K, detJ, J);
 
163
    
167
164
    
168
165
    // Compute constants
169
166
    
204
201
    }
205
202
    
206
203
    // Compute inverse of Jacobian
207
 
    const double Jinv[2][2] = {{K_00, K_01}, {K_10, K_11}};
 
204
    const double Jinv[2][2] = {{K[0], K[1]}, {K[2], K[3]}};
208
205
    
209
206
    // Declare transformation matrix
210
207
    // Declare pointer to two dimensional array and initialise
234
231
    }// end loop over 'r'
235
232
    
236
233
    
237
 
    // Array of basisvalues.
 
234
    // Array of basisvalues
238
235
    double basisvalues[1] = {0.0};
239
236
    
240
 
    // Declare helper variables.
 
237
    // Declare helper variables
241
238
    
242
 
    // Compute basisvalues.
 
239
    // Compute basisvalues
243
240
    basisvalues[0] = 1.0;
244
241
    
245
 
    // Table(s) of coefficients.
 
242
    // Table(s) of coefficients
246
243
    static const double coefficients0[1] = \
247
244
    {1.0};
248
245
    
363
360
    delete [] transform;
364
361
  }
365
362
 
366
 
  /// Evaluate order n derivatives of all basis functions at given point in cell
367
 
  virtual void evaluate_basis_derivatives_all(unsigned int n,
 
363
  /// Evaluate order n derivatives of all basis functions at given point x in cell
 
364
  virtual void evaluate_basis_derivatives_all(std::size_t n,
368
365
                                              double* values,
369
 
                                              const double* coordinates,
370
 
                                              const ufc::cell& c) const
 
366
                                              const double* x,
 
367
                                              const double* vertex_coordinates,
 
368
                                              int cell_orientation) const
371
369
  {
372
370
    // Element is constant, calling evaluate_basis_derivatives.
373
 
    evaluate_basis_derivatives(0, n, values, coordinates, c);
 
371
    evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
374
372
  }
375
373
 
376
374
  /// Evaluate linear functional for dof i on the function f
377
 
  virtual double evaluate_dof(unsigned int i,
 
375
  virtual double evaluate_dof(std::size_t i,
378
376
                              const ufc::function& f,
 
377
                              const double* vertex_coordinates,
 
378
                              int cell_orientation,
379
379
                              const ufc::cell& c) const
380
380
  {
381
 
    // Declare variables for result of evaluation.
 
381
    // Declare variables for result of evaluation
382
382
    double vals[1];
383
383
    
384
 
    // Declare variable for physical coordinates.
 
384
    // Declare variable for physical coordinates
385
385
    double y[2];
386
 
    const double * const * x = c.coordinates;
387
386
    switch (i)
388
387
    {
389
388
    case 0:
390
389
      {
391
 
        y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
392
 
      y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
390
        y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
391
      y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
393
392
      f.evaluate(vals, y, c);
394
393
      return vals[0];
395
394
        break;
402
401
  /// Evaluate linear functionals for all dofs on the function f
403
402
  virtual void evaluate_dofs(double* values,
404
403
                             const ufc::function& f,
 
404
                             const double* vertex_coordinates,
 
405
                             int cell_orientation,
405
406
                             const ufc::cell& c) const
406
407
  {
407
 
    // Declare variables for result of evaluation.
 
408
    // Declare variables for result of evaluation
408
409
    double vals[1];
409
410
    
410
 
    // Declare variable for physical coordinates.
 
411
    // Declare variable for physical coordinates
411
412
    double y[2];
412
 
    const double * const * x = c.coordinates;
413
 
    y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
414
 
    y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
413
    y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
414
    y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
415
415
    f.evaluate(vals, y, c);
416
416
    values[0] = vals[0];
417
417
  }
419
419
  /// Interpolate vertex values from dof values
420
420
  virtual void interpolate_vertex_values(double* vertex_values,
421
421
                                         const double* dof_values,
 
422
                                         const double* vertex_coordinates,
 
423
                                         int cell_orientation,
422
424
                                         const ufc::cell& c) const
423
425
  {
424
426
    // Evaluate function and change variables
432
434
                                       const double* xhat,
433
435
                                       const ufc::cell& c) const
434
436
  {
435
 
    std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented (introduced in UFC 2.0)." << std::endl;
 
437
    std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented." << std::endl;
436
438
  }
437
439
 
438
440
  /// Map from coordinate x in cell to coordinate xhat in reference cell
440
442
                                     const double* x,
441
443
                                     const ufc::cell& c) const
442
444
  {
443
 
    std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented (introduced in UFC 2.0)." << std::endl;
 
445
    std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented." << std::endl;
444
446
  }
445
447
 
446
448
  /// Return the number of sub elements (for a mixed element)
447
 
  virtual unsigned int num_sub_elements() const
 
449
  virtual std::size_t num_sub_elements() const
448
450
  {
449
451
    return 0;
450
452
  }
451
453
 
452
454
  /// Create a new finite element for sub element i (for a mixed element)
453
 
  virtual ufc::finite_element* create_sub_element(unsigned int i) const
 
455
  virtual ufc::finite_element* create_sub_element(std::size_t i) const
454
456
  {
455
457
    return 0;
456
458
  }
484
486
  /// Return a string identifying the finite element
485
487
  virtual const char* signature() const
486
488
  {
487
 
    return "VectorElement('Real', Cell('triangle', Space(2)), 0, 3, None)";
 
489
    return "VectorElement('Real', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 0, 3, None)";
488
490
  }
489
491
 
490
492
  /// Return the cell shape
494
496
  }
495
497
 
496
498
  /// Return the topological dimension of the cell shape
497
 
  virtual unsigned int topological_dimension() const
 
499
  virtual std::size_t topological_dimension() const
498
500
  {
499
501
    return 2;
500
502
  }
501
503
 
502
504
  /// Return the geometric dimension of the cell shape
503
 
  virtual unsigned int geometric_dimension() const
 
505
  virtual std::size_t geometric_dimension() const
504
506
  {
505
507
    return 2;
506
508
  }
507
509
 
508
510
  /// Return the dimension of the finite element function space
509
 
  virtual unsigned int space_dimension() const
 
511
  virtual std::size_t space_dimension() const
510
512
  {
511
513
    return 3;
512
514
  }
513
515
 
514
516
  /// Return the rank of the value space
515
 
  virtual unsigned int value_rank() const
 
517
  virtual std::size_t value_rank() const
516
518
  {
517
519
    return 1;
518
520
  }
519
521
 
520
522
  /// Return the dimension of the value space for axis i
521
 
  virtual unsigned int value_dimension(unsigned int i) const
 
523
  virtual std::size_t value_dimension(std::size_t i) const
522
524
  {
523
525
    switch (i)
524
526
    {
532
534
    return 0;
533
535
  }
534
536
 
535
 
  /// Evaluate basis function i at given point in cell
536
 
  virtual void evaluate_basis(unsigned int i,
 
537
  /// Evaluate basis function i at given point x in cell
 
538
  virtual void evaluate_basis(std::size_t i,
537
539
                              double* values,
538
 
                              const double* coordinates,
539
 
                              const ufc::cell& c) const
 
540
                              const double* x,
 
541
                              const double* vertex_coordinates,
 
542
                              int cell_orientation) const
540
543
  {
541
 
    // Extract vertex coordinates
542
 
    
543
 
    // Compute Jacobian of affine map from reference cell
544
 
    
545
 
    // Compute determinant of Jacobian
546
 
    
547
 
    // Compute inverse of Jacobian
 
544
    // Compute Jacobian
 
545
    double J[4];
 
546
    compute_jacobian_triangle_2d(J, vertex_coordinates);
 
547
    
 
548
    // Compute Jacobian inverse and determinant
 
549
    double K[4];
 
550
    double detJ;
 
551
    compute_jacobian_inverse_triangle_2d(K, detJ, J);
 
552
    
548
553
    
549
554
    // Compute constants
550
555
    
551
556
    // Get coordinates and map to the reference (FIAT) element
552
557
    
553
 
    // Reset values.
 
558
    // Reset values
554
559
    values[0] = 0.0;
555
560
    values[1] = 0.0;
556
561
    values[2] = 0.0;
559
564
    case 0:
560
565
      {
561
566
        
562
 
      // Array of basisvalues.
 
567
      // Array of basisvalues
563
568
      double basisvalues[1] = {0.0};
564
569
      
565
 
      // Declare helper variables.
 
570
      // Declare helper variables
566
571
      
567
 
      // Compute basisvalues.
 
572
      // Compute basisvalues
568
573
      basisvalues[0] = 1.0;
569
574
      
570
 
      // Table(s) of coefficients.
 
575
      // Table(s) of coefficients
571
576
      static const double coefficients0[1] = \
572
577
      {1.0};
573
578
      
574
 
      // Compute value(s).
 
579
      // Compute value(s)
575
580
      for (unsigned int r = 0; r < 1; r++)
576
581
      {
577
582
        values[0] += coefficients0[r]*basisvalues[r];
581
586
    case 1:
582
587
      {
583
588
        
584
 
      // Array of basisvalues.
 
589
      // Array of basisvalues
585
590
      double basisvalues[1] = {0.0};
586
591
      
587
 
      // Declare helper variables.
 
592
      // Declare helper variables
588
593
      
589
 
      // Compute basisvalues.
 
594
      // Compute basisvalues
590
595
      basisvalues[0] = 1.0;
591
596
      
592
 
      // Table(s) of coefficients.
 
597
      // Table(s) of coefficients
593
598
      static const double coefficients0[1] = \
594
599
      {1.0};
595
600
      
596
 
      // Compute value(s).
 
601
      // Compute value(s)
597
602
      for (unsigned int r = 0; r < 1; r++)
598
603
      {
599
604
        values[1] += coefficients0[r]*basisvalues[r];
603
608
    case 2:
604
609
      {
605
610
        
606
 
      // Array of basisvalues.
 
611
      // Array of basisvalues
607
612
      double basisvalues[1] = {0.0};
608
613
      
609
 
      // Declare helper variables.
 
614
      // Declare helper variables
610
615
      
611
 
      // Compute basisvalues.
 
616
      // Compute basisvalues
612
617
      basisvalues[0] = 1.0;
613
618
      
614
 
      // Table(s) of coefficients.
 
619
      // Table(s) of coefficients
615
620
      static const double coefficients0[1] = \
616
621
      {1.0};
617
622
      
618
 
      // Compute value(s).
 
623
      // Compute value(s)
619
624
      for (unsigned int r = 0; r < 1; r++)
620
625
      {
621
626
        values[2] += coefficients0[r]*basisvalues[r];
626
631
    
627
632
  }
628
633
 
629
 
  /// Evaluate all basis functions at given point in cell
 
634
  /// Evaluate all basis functions at given point x in cell
630
635
  virtual void evaluate_basis_all(double* values,
631
 
                                  const double* coordinates,
632
 
                                  const ufc::cell& c) const
 
636
                                  const double* x,
 
637
                                  const double* vertex_coordinates,
 
638
                                  int cell_orientation) const
633
639
  {
634
640
    // Helper variable to hold values of a single dof.
635
641
    double dof_values[3] = {0.0, 0.0, 0.0};
636
642
    
637
 
    // Loop dofs and call evaluate_basis.
 
643
    // Loop dofs and call evaluate_basis
638
644
    for (unsigned int r = 0; r < 3; r++)
639
645
    {
640
 
      evaluate_basis(r, dof_values, coordinates, c);
 
646
      evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
641
647
      for (unsigned int s = 0; s < 3; s++)
642
648
      {
643
649
        values[r*3 + s] = dof_values[s];
645
651
    }// end loop over 'r'
646
652
  }
647
653
 
648
 
  /// Evaluate order n derivatives of basis function i at given point in cell
649
 
  virtual void evaluate_basis_derivatives(unsigned int i,
650
 
                                          unsigned int n,
 
654
  /// Evaluate order n derivatives of basis function i at given point x in cell
 
655
  virtual void evaluate_basis_derivatives(std::size_t i,
 
656
                                          std::size_t n,
651
657
                                          double* values,
652
 
                                          const double* coordinates,
653
 
                                          const ufc::cell& c) const
 
658
                                          const double* x,
 
659
                                          const double* vertex_coordinates,
 
660
                                          int cell_orientation) const
654
661
  {
655
 
    // Extract vertex coordinates
656
 
    const double * const * x = c.coordinates;
657
 
    
658
 
    // Compute Jacobian of affine map from reference cell
659
 
    const double J_00 = x[1][0] - x[0][0];
660
 
    const double J_01 = x[2][0] - x[0][0];
661
 
    const double J_10 = x[1][1] - x[0][1];
662
 
    const double J_11 = x[2][1] - x[0][1];
663
 
    
664
 
    // Compute determinant of Jacobian
665
 
    double detJ = J_00*J_11 - J_01*J_10;
666
 
    
667
 
    // Compute inverse of Jacobian
668
 
    const double K_00 =  J_11 / detJ;
669
 
    const double K_01 = -J_01 / detJ;
670
 
    const double K_10 = -J_10 / detJ;
671
 
    const double K_11 =  J_00 / detJ;
 
662
    // Compute Jacobian
 
663
    double J[4];
 
664
    compute_jacobian_triangle_2d(J, vertex_coordinates);
 
665
    
 
666
    // Compute Jacobian inverse and determinant
 
667
    double K[4];
 
668
    double detJ;
 
669
    compute_jacobian_inverse_triangle_2d(K, detJ, J);
 
670
    
672
671
    
673
672
    // Compute constants
674
673
    
709
708
    }
710
709
    
711
710
    // Compute inverse of Jacobian
712
 
    const double Jinv[2][2] = {{K_00, K_01}, {K_10, K_11}};
 
711
    const double Jinv[2][2] = {{K[0], K[1]}, {K[2], K[3]}};
713
712
    
714
713
    // Declare transformation matrix
715
714
    // Declare pointer to two dimensional array and initialise
743
742
    case 0:
744
743
      {
745
744
        
746
 
      // Array of basisvalues.
 
745
      // Array of basisvalues
747
746
      double basisvalues[1] = {0.0};
748
747
      
749
 
      // Declare helper variables.
 
748
      // Declare helper variables
750
749
      
751
 
      // Compute basisvalues.
 
750
      // Compute basisvalues
752
751
      basisvalues[0] = 1.0;
753
752
      
754
 
      // Table(s) of coefficients.
 
753
      // Table(s) of coefficients
755
754
      static const double coefficients0[1] = \
756
755
      {1.0};
757
756
      
875
874
    case 1:
876
875
      {
877
876
        
878
 
      // Array of basisvalues.
 
877
      // Array of basisvalues
879
878
      double basisvalues[1] = {0.0};
880
879
      
881
 
      // Declare helper variables.
 
880
      // Declare helper variables
882
881
      
883
 
      // Compute basisvalues.
 
882
      // Compute basisvalues
884
883
      basisvalues[0] = 1.0;
885
884
      
886
 
      // Table(s) of coefficients.
 
885
      // Table(s) of coefficients
887
886
      static const double coefficients0[1] = \
888
887
      {1.0};
889
888
      
1007
1006
    case 2:
1008
1007
      {
1009
1008
        
1010
 
      // Array of basisvalues.
 
1009
      // Array of basisvalues
1011
1010
      double basisvalues[1] = {0.0};
1012
1011
      
1013
 
      // Declare helper variables.
 
1012
      // Declare helper variables
1014
1013
      
1015
 
      // Compute basisvalues.
 
1014
      // Compute basisvalues
1016
1015
      basisvalues[0] = 1.0;
1017
1016
      
1018
 
      // Table(s) of coefficients.
 
1017
      // Table(s) of coefficients
1019
1018
      static const double coefficients0[1] = \
1020
1019
      {1.0};
1021
1020
      
1140
1139
    
1141
1140
  }
1142
1141
 
1143
 
  /// Evaluate order n derivatives of all basis functions at given point in cell
1144
 
  virtual void evaluate_basis_derivatives_all(unsigned int n,
 
1142
  /// Evaluate order n derivatives of all basis functions at given point x in cell
 
1143
  virtual void evaluate_basis_derivatives_all(std::size_t n,
1145
1144
                                              double* values,
1146
 
                                              const double* coordinates,
1147
 
                                              const ufc::cell& c) const
 
1145
                                              const double* x,
 
1146
                                              const double* vertex_coordinates,
 
1147
                                              int cell_orientation) const
1148
1148
  {
1149
1149
    // Compute number of derivatives.
1150
1150
    unsigned int num_derivatives = 1;
1163
1163
    // Loop dofs and call evaluate_basis_derivatives.
1164
1164
    for (unsigned int r = 0; r < 3; r++)
1165
1165
    {
1166
 
      evaluate_basis_derivatives(r, n, dof_values, coordinates, c);
 
1166
      evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
1167
1167
      for (unsigned int s = 0; s < 3*num_derivatives; s++)
1168
1168
      {
1169
1169
        values[r*3*num_derivatives + s] = dof_values[s];
1175
1175
  }
1176
1176
 
1177
1177
  /// Evaluate linear functional for dof i on the function f
1178
 
  virtual double evaluate_dof(unsigned int i,
 
1178
  virtual double evaluate_dof(std::size_t i,
1179
1179
                              const ufc::function& f,
 
1180
                              const double* vertex_coordinates,
 
1181
                              int cell_orientation,
1180
1182
                              const ufc::cell& c) const
1181
1183
  {
1182
 
    // Declare variables for result of evaluation.
 
1184
    // Declare variables for result of evaluation
1183
1185
    double vals[3];
1184
1186
    
1185
 
    // Declare variable for physical coordinates.
 
1187
    // Declare variable for physical coordinates
1186
1188
    double y[2];
1187
 
    const double * const * x = c.coordinates;
1188
1189
    switch (i)
1189
1190
    {
1190
1191
    case 0:
1191
1192
      {
1192
 
        y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1193
 
      y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
1193
        y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
1194
      y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
1194
1195
      f.evaluate(vals, y, c);
1195
1196
      return vals[0];
1196
1197
        break;
1197
1198
      }
1198
1199
    case 1:
1199
1200
      {
1200
 
        y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1201
 
      y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
1201
        y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
1202
      y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
1202
1203
      f.evaluate(vals, y, c);
1203
1204
      return vals[1];
1204
1205
        break;
1205
1206
      }
1206
1207
    case 2:
1207
1208
      {
1208
 
        y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1209
 
      y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
1209
        y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
1210
      y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
1210
1211
      f.evaluate(vals, y, c);
1211
1212
      return vals[2];
1212
1213
        break;
1219
1220
  /// Evaluate linear functionals for all dofs on the function f
1220
1221
  virtual void evaluate_dofs(double* values,
1221
1222
                             const ufc::function& f,
 
1223
                             const double* vertex_coordinates,
 
1224
                             int cell_orientation,
1222
1225
                             const ufc::cell& c) const
1223
1226
  {
1224
 
    // Declare variables for result of evaluation.
 
1227
    // Declare variables for result of evaluation
1225
1228
    double vals[3];
1226
1229
    
1227
 
    // Declare variable for physical coordinates.
 
1230
    // Declare variable for physical coordinates
1228
1231
    double y[2];
1229
 
    const double * const * x = c.coordinates;
1230
 
    y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1231
 
    y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
1232
    y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
1233
    y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
1232
1234
    f.evaluate(vals, y, c);
1233
1235
    values[0] = vals[0];
1234
 
    y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1235
 
    y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
1236
    y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
1237
    y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
1236
1238
    f.evaluate(vals, y, c);
1237
1239
    values[1] = vals[1];
1238
 
    y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1239
 
    y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
1240
    y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
1241
    y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
1240
1242
    f.evaluate(vals, y, c);
1241
1243
    values[2] = vals[2];
1242
1244
  }
1244
1246
  /// Interpolate vertex values from dof values
1245
1247
  virtual void interpolate_vertex_values(double* vertex_values,
1246
1248
                                         const double* dof_values,
 
1249
                                         const double* vertex_coordinates,
 
1250
                                         int cell_orientation,
1247
1251
                                         const ufc::cell& c) const
1248
1252
  {
1249
1253
    // Evaluate function and change variables
1265
1269
                                       const double* xhat,
1266
1270
                                       const ufc::cell& c) const
1267
1271
  {
1268
 
    std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented (introduced in UFC 2.0)." << std::endl;
 
1272
    std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented." << std::endl;
1269
1273
  }
1270
1274
 
1271
1275
  /// Map from coordinate x in cell to coordinate xhat in reference cell
1273
1277
                                     const double* x,
1274
1278
                                     const ufc::cell& c) const
1275
1279
  {
1276
 
    std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented (introduced in UFC 2.0)." << std::endl;
 
1280
    std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented." << std::endl;
1277
1281
  }
1278
1282
 
1279
1283
  /// Return the number of sub elements (for a mixed element)
1280
 
  virtual unsigned int num_sub_elements() const
 
1284
  virtual std::size_t num_sub_elements() const
1281
1285
  {
1282
1286
    return 3;
1283
1287
  }
1284
1288
 
1285
1289
  /// Create a new finite element for sub element i (for a mixed element)
1286
 
  virtual ufc::finite_element* create_sub_element(unsigned int i) const
 
1290
  virtual ufc::finite_element* create_sub_element(std::size_t i) const
1287
1291
  {
1288
1292
    switch (i)
1289
1293
    {
1320
1324
 
1321
1325
class x_element2_dofmap_0: public ufc::dofmap
1322
1326
{
1323
 
private:
1324
 
 
1325
 
  unsigned int _global_dimension;
1326
1327
public:
1327
1328
 
1328
1329
  /// Constructor
1329
1330
  x_element2_dofmap_0() : ufc::dofmap()
1330
1331
  {
1331
 
    _global_dimension = 0;
 
1332
    // Do nothing
1332
1333
  }
1333
1334
 
1334
1335
  /// Destructor
1340
1341
  /// Return a string identifying the dofmap
1341
1342
  virtual const char* signature() const
1342
1343
  {
1343
 
    return "FFC dofmap for FiniteElement('Real', Cell('triangle', Space(2)), 0, None)";
 
1344
    return "FFC dofmap for FiniteElement('Real', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 0, None)";
1344
1345
  }
1345
1346
 
1346
1347
  /// Return true iff mesh entities of topological dimension d are needed
1347
 
  virtual bool needs_mesh_entities(unsigned int d) const
 
1348
  virtual bool needs_mesh_entities(std::size_t d) const
1348
1349
  {
1349
1350
    switch (d)
1350
1351
    {
1368
1369
    return false;
1369
1370
  }
1370
1371
 
1371
 
  /// Initialize dofmap for mesh (return true iff init_cell() is needed)
1372
 
  virtual bool init_mesh(const ufc::mesh& m)
1373
 
  {
1374
 
    _global_dimension = 1;
1375
 
    return false;
1376
 
  }
1377
 
 
1378
 
  /// Initialize dofmap for given cell
1379
 
  virtual void init_cell(const ufc::mesh& m,
1380
 
                         const ufc::cell& c)
1381
 
  {
1382
 
    // Do nothing
1383
 
  }
1384
 
 
1385
 
  /// Finish initialization of dofmap for cells
1386
 
  virtual void init_cell_finalize()
1387
 
  {
1388
 
    // Do nothing
1389
 
  }
1390
 
 
1391
1372
  /// Return the topological dimension of the associated cell shape
1392
 
  virtual unsigned int topological_dimension() const
 
1373
  virtual std::size_t topological_dimension() const
1393
1374
  {
1394
1375
    return 2;
1395
1376
  }
1396
1377
 
1397
1378
  /// Return the geometric dimension of the associated cell shape
1398
 
  virtual unsigned int geometric_dimension() const
 
1379
  virtual std::size_t geometric_dimension() const
1399
1380
  {
1400
1381
    return 2;
1401
1382
  }
1402
1383
 
1403
1384
  /// Return the dimension of the global finite element function space
1404
 
  virtual unsigned int global_dimension() const
 
1385
  virtual std::size_t global_dimension(const std::vector<std::size_t>&
 
1386
                                       num_global_entities) const
1405
1387
  {
1406
 
    return _global_dimension;
 
1388
    return 1;
1407
1389
  }
1408
1390
 
1409
1391
  /// Return the dimension of the local finite element function space for a cell
1410
 
  virtual unsigned int local_dimension(const ufc::cell& c) const
 
1392
  virtual std::size_t local_dimension(const ufc::cell& c) const
1411
1393
  {
1412
1394
    return 1;
1413
1395
  }
1414
1396
 
1415
1397
  /// Return the maximum dimension of the local finite element function space
1416
 
  virtual unsigned int max_local_dimension() const
 
1398
  virtual std::size_t max_local_dimension() const
1417
1399
  {
1418
1400
    return 1;
1419
1401
  }
1420
1402
 
1421
1403
  /// Return the number of dofs on each cell facet
1422
 
  virtual unsigned int num_facet_dofs() const
 
1404
  virtual std::size_t num_facet_dofs() const
1423
1405
  {
1424
1406
    return 0;
1425
1407
  }
1426
1408
 
1427
1409
  /// Return the number of dofs associated with each cell entity of dimension d
1428
 
  virtual unsigned int num_entity_dofs(unsigned int d) const
 
1410
  virtual std::size_t num_entity_dofs(std::size_t d) const
1429
1411
  {
1430
1412
    switch (d)
1431
1413
    {
1450
1432
  }
1451
1433
 
1452
1434
  /// Tabulate the local-to-global mapping of dofs on a cell
1453
 
  virtual void tabulate_dofs(unsigned int* dofs,
1454
 
                             const ufc::mesh& m,
 
1435
  virtual void tabulate_dofs(std::size_t* dofs,
 
1436
                             const std::vector<std::size_t>& num_global_entities,
1455
1437
                             const ufc::cell& c) const
1456
1438
  {
1457
1439
    dofs[0] = 0;
1458
1440
  }
1459
1441
 
1460
1442
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
1461
 
  virtual void tabulate_facet_dofs(unsigned int* dofs,
1462
 
                                   unsigned int facet) const
 
1443
  virtual void tabulate_facet_dofs(std::size_t* dofs,
 
1444
                                   std::size_t facet) const
1463
1445
  {
1464
1446
    switch (facet)
1465
1447
    {
1483
1465
  }
1484
1466
 
1485
1467
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
1486
 
  virtual void tabulate_entity_dofs(unsigned int* dofs,
1487
 
                                    unsigned int d, unsigned int i) const
 
1468
  virtual void tabulate_entity_dofs(std::size_t* dofs,
 
1469
                                    std::size_t d, std::size_t i) const
1488
1470
  {
1489
1471
    if (d > 2)
1490
1472
    {
1518
1500
  }
1519
1501
 
1520
1502
  /// Tabulate the coordinates of all dofs on a cell
1521
 
  virtual void tabulate_coordinates(double** coordinates,
1522
 
                                    const ufc::cell& c) const
 
1503
  virtual void tabulate_coordinates(double** dof_coordinates,
 
1504
                                    const double* vertex_coordinates) const
1523
1505
  {
1524
 
    const double * const * x = c.coordinates;
1525
 
    
1526
 
    coordinates[0][0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1527
 
    coordinates[0][1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
1506
    dof_coordinates[0][0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
1507
    dof_coordinates[0][1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
1528
1508
  }
1529
1509
 
1530
1510
  /// Return the number of sub dofmaps (for a mixed element)
1531
 
  virtual unsigned int num_sub_dofmaps() const
 
1511
  virtual std::size_t num_sub_dofmaps() const
1532
1512
  {
1533
1513
    return 0;
1534
1514
  }
1535
1515
 
1536
1516
  /// Create a new dofmap for sub dofmap i (for a mixed element)
1537
 
  virtual ufc::dofmap* create_sub_dofmap(unsigned int i) const
 
1517
  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
1538
1518
  {
1539
1519
    return 0;
1540
1520
  }
1552
1532
 
1553
1533
class x_element2_dofmap_1: public ufc::dofmap
1554
1534
{
1555
 
private:
1556
 
 
1557
 
  unsigned int _global_dimension;
1558
1535
public:
1559
1536
 
1560
1537
  /// Constructor
1561
1538
  x_element2_dofmap_1() : ufc::dofmap()
1562
1539
  {
1563
 
    _global_dimension = 0;
 
1540
    // Do nothing
1564
1541
  }
1565
1542
 
1566
1543
  /// Destructor
1572
1549
  /// Return a string identifying the dofmap
1573
1550
  virtual const char* signature() const
1574
1551
  {
1575
 
    return "FFC dofmap for VectorElement('Real', Cell('triangle', Space(2)), 0, 3, None)";
 
1552
    return "FFC dofmap for VectorElement('Real', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 0, 3, None)";
1576
1553
  }
1577
1554
 
1578
1555
  /// Return true iff mesh entities of topological dimension d are needed
1579
 
  virtual bool needs_mesh_entities(unsigned int d) const
 
1556
  virtual bool needs_mesh_entities(std::size_t d) const
1580
1557
  {
1581
1558
    switch (d)
1582
1559
    {
1600
1577
    return false;
1601
1578
  }
1602
1579
 
1603
 
  /// Initialize dofmap for mesh (return true iff init_cell() is needed)
1604
 
  virtual bool init_mesh(const ufc::mesh& m)
1605
 
  {
1606
 
    _global_dimension = 3;
1607
 
    return false;
1608
 
  }
1609
 
 
1610
 
  /// Initialize dofmap for given cell
1611
 
  virtual void init_cell(const ufc::mesh& m,
1612
 
                         const ufc::cell& c)
1613
 
  {
1614
 
    // Do nothing
1615
 
  }
1616
 
 
1617
 
  /// Finish initialization of dofmap for cells
1618
 
  virtual void init_cell_finalize()
1619
 
  {
1620
 
    // Do nothing
1621
 
  }
1622
 
 
1623
1580
  /// Return the topological dimension of the associated cell shape
1624
 
  virtual unsigned int topological_dimension() const
 
1581
  virtual std::size_t topological_dimension() const
1625
1582
  {
1626
1583
    return 2;
1627
1584
  }
1628
1585
 
1629
1586
  /// Return the geometric dimension of the associated cell shape
1630
 
  virtual unsigned int geometric_dimension() const
 
1587
  virtual std::size_t geometric_dimension() const
1631
1588
  {
1632
1589
    return 2;
1633
1590
  }
1634
1591
 
1635
1592
  /// Return the dimension of the global finite element function space
1636
 
  virtual unsigned int global_dimension() const
 
1593
  virtual std::size_t global_dimension(const std::vector<std::size_t>&
 
1594
                                       num_global_entities) const
1637
1595
  {
1638
 
    return _global_dimension;
 
1596
    return 3;
1639
1597
  }
1640
1598
 
1641
1599
  /// Return the dimension of the local finite element function space for a cell
1642
 
  virtual unsigned int local_dimension(const ufc::cell& c) const
 
1600
  virtual std::size_t local_dimension(const ufc::cell& c) const
1643
1601
  {
1644
1602
    return 3;
1645
1603
  }
1646
1604
 
1647
1605
  /// Return the maximum dimension of the local finite element function space
1648
 
  virtual unsigned int max_local_dimension() const
 
1606
  virtual std::size_t max_local_dimension() const
1649
1607
  {
1650
1608
    return 3;
1651
1609
  }
1652
1610
 
1653
1611
  /// Return the number of dofs on each cell facet
1654
 
  virtual unsigned int num_facet_dofs() const
 
1612
  virtual std::size_t num_facet_dofs() const
1655
1613
  {
1656
1614
    return 0;
1657
1615
  }
1658
1616
 
1659
1617
  /// Return the number of dofs associated with each cell entity of dimension d
1660
 
  virtual unsigned int num_entity_dofs(unsigned int d) const
 
1618
  virtual std::size_t num_entity_dofs(std::size_t d) const
1661
1619
  {
1662
1620
    switch (d)
1663
1621
    {
1682
1640
  }
1683
1641
 
1684
1642
  /// Tabulate the local-to-global mapping of dofs on a cell
1685
 
  virtual void tabulate_dofs(unsigned int* dofs,
1686
 
                             const ufc::mesh& m,
 
1643
  virtual void tabulate_dofs(std::size_t* dofs,
 
1644
                             const std::vector<std::size_t>& num_global_entities,
1687
1645
                             const ufc::cell& c) const
1688
1646
  {
1689
1647
    unsigned int offset = 0;
1696
1654
  }
1697
1655
 
1698
1656
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
1699
 
  virtual void tabulate_facet_dofs(unsigned int* dofs,
1700
 
                                   unsigned int facet) const
 
1657
  virtual void tabulate_facet_dofs(std::size_t* dofs,
 
1658
                                   std::size_t facet) const
1701
1659
  {
1702
1660
    switch (facet)
1703
1661
    {
1721
1679
  }
1722
1680
 
1723
1681
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
1724
 
  virtual void tabulate_entity_dofs(unsigned int* dofs,
1725
 
                                    unsigned int d, unsigned int i) const
 
1682
  virtual void tabulate_entity_dofs(std::size_t* dofs,
 
1683
                                    std::size_t d, std::size_t i) const
1726
1684
  {
1727
1685
    if (d > 2)
1728
1686
    {
1758
1716
  }
1759
1717
 
1760
1718
  /// Tabulate the coordinates of all dofs on a cell
1761
 
  virtual void tabulate_coordinates(double** coordinates,
1762
 
                                    const ufc::cell& c) const
 
1719
  virtual void tabulate_coordinates(double** dof_coordinates,
 
1720
                                    const double* vertex_coordinates) const
1763
1721
  {
1764
 
    const double * const * x = c.coordinates;
1765
 
    
1766
 
    coordinates[0][0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1767
 
    coordinates[0][1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
1768
 
    coordinates[1][0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1769
 
    coordinates[1][1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
1770
 
    coordinates[2][0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1771
 
    coordinates[2][1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
1722
    dof_coordinates[0][0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
1723
    dof_coordinates[0][1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
 
1724
    dof_coordinates[1][0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
1725
    dof_coordinates[1][1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
 
1726
    dof_coordinates[2][0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
1727
    dof_coordinates[2][1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
1772
1728
  }
1773
1729
 
1774
1730
  /// Return the number of sub dofmaps (for a mixed element)
1775
 
  virtual unsigned int num_sub_dofmaps() const
 
1731
  virtual std::size_t num_sub_dofmaps() const
1776
1732
  {
1777
1733
    return 3;
1778
1734
  }
1779
1735
 
1780
1736
  /// Create a new dofmap for sub dofmap i (for a mixed element)
1781
 
  virtual ufc::dofmap* create_sub_dofmap(unsigned int i) const
 
1737
  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
1782
1738
  {
1783
1739
    switch (i)
1784
1740
    {