~ubuntu-branches/ubuntu/wily/ffc/wily

« back to all changes in this revision

Viewing changes to test/regression/references/r_auto/MixedMixedElement.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('Discontinuous Lagrange', Cell('triangle', Space(2)), 0, None)";
 
55
    return "FiniteElement('Discontinuous Lagrange', 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('Discontinuous Lagrange', Cell('triangle', Space(2)), 0, 2, None)";
 
489
    return "VectorElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 0, 2, 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 2;
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
    switch (i)
558
563
    case 0:
559
564
      {
560
565
        
561
 
      // Array of basisvalues.
 
566
      // Array of basisvalues
562
567
      double basisvalues[1] = {0.0};
563
568
      
564
 
      // Declare helper variables.
 
569
      // Declare helper variables
565
570
      
566
 
      // Compute basisvalues.
 
571
      // Compute basisvalues
567
572
      basisvalues[0] = 1.0;
568
573
      
569
 
      // Table(s) of coefficients.
 
574
      // Table(s) of coefficients
570
575
      static const double coefficients0[1] = \
571
576
      {1.0};
572
577
      
573
 
      // Compute value(s).
 
578
      // Compute value(s)
574
579
      for (unsigned int r = 0; r < 1; r++)
575
580
      {
576
581
        values[0] += coefficients0[r]*basisvalues[r];
580
585
    case 1:
581
586
      {
582
587
        
583
 
      // Array of basisvalues.
 
588
      // Array of basisvalues
584
589
      double basisvalues[1] = {0.0};
585
590
      
586
 
      // Declare helper variables.
 
591
      // Declare helper variables
587
592
      
588
 
      // Compute basisvalues.
 
593
      // Compute basisvalues
589
594
      basisvalues[0] = 1.0;
590
595
      
591
 
      // Table(s) of coefficients.
 
596
      // Table(s) of coefficients
592
597
      static const double coefficients0[1] = \
593
598
      {1.0};
594
599
      
595
 
      // Compute value(s).
 
600
      // Compute value(s)
596
601
      for (unsigned int r = 0; r < 1; r++)
597
602
      {
598
603
        values[1] += coefficients0[r]*basisvalues[r];
603
608
    
604
609
  }
605
610
 
606
 
  /// Evaluate all basis functions at given point in cell
 
611
  /// Evaluate all basis functions at given point x in cell
607
612
  virtual void evaluate_basis_all(double* values,
608
 
                                  const double* coordinates,
609
 
                                  const ufc::cell& c) const
 
613
                                  const double* x,
 
614
                                  const double* vertex_coordinates,
 
615
                                  int cell_orientation) const
610
616
  {
611
617
    // Helper variable to hold values of a single dof.
612
618
    double dof_values[2] = {0.0, 0.0};
613
619
    
614
 
    // Loop dofs and call evaluate_basis.
 
620
    // Loop dofs and call evaluate_basis
615
621
    for (unsigned int r = 0; r < 2; r++)
616
622
    {
617
 
      evaluate_basis(r, dof_values, coordinates, c);
 
623
      evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
618
624
      for (unsigned int s = 0; s < 2; s++)
619
625
      {
620
626
        values[r*2 + s] = dof_values[s];
622
628
    }// end loop over 'r'
623
629
  }
624
630
 
625
 
  /// Evaluate order n derivatives of basis function i at given point in cell
626
 
  virtual void evaluate_basis_derivatives(unsigned int i,
627
 
                                          unsigned int n,
 
631
  /// Evaluate order n derivatives of basis function i at given point x in cell
 
632
  virtual void evaluate_basis_derivatives(std::size_t i,
 
633
                                          std::size_t n,
628
634
                                          double* values,
629
 
                                          const double* coordinates,
630
 
                                          const ufc::cell& c) const
 
635
                                          const double* x,
 
636
                                          const double* vertex_coordinates,
 
637
                                          int cell_orientation) const
631
638
  {
632
 
    // Extract vertex coordinates
633
 
    const double * const * x = c.coordinates;
634
 
    
635
 
    // Compute Jacobian of affine map from reference cell
636
 
    const double J_00 = x[1][0] - x[0][0];
637
 
    const double J_01 = x[2][0] - x[0][0];
638
 
    const double J_10 = x[1][1] - x[0][1];
639
 
    const double J_11 = x[2][1] - x[0][1];
640
 
    
641
 
    // Compute determinant of Jacobian
642
 
    double detJ = J_00*J_11 - J_01*J_10;
643
 
    
644
 
    // Compute inverse of Jacobian
645
 
    const double K_00 =  J_11 / detJ;
646
 
    const double K_01 = -J_01 / detJ;
647
 
    const double K_10 = -J_10 / detJ;
648
 
    const double K_11 =  J_00 / detJ;
 
639
    // Compute Jacobian
 
640
    double J[4];
 
641
    compute_jacobian_triangle_2d(J, vertex_coordinates);
 
642
    
 
643
    // Compute Jacobian inverse and determinant
 
644
    double K[4];
 
645
    double detJ;
 
646
    compute_jacobian_inverse_triangle_2d(K, detJ, J);
 
647
    
649
648
    
650
649
    // Compute constants
651
650
    
686
685
    }
687
686
    
688
687
    // Compute inverse of Jacobian
689
 
    const double Jinv[2][2] = {{K_00, K_01}, {K_10, K_11}};
 
688
    const double Jinv[2][2] = {{K[0], K[1]}, {K[2], K[3]}};
690
689
    
691
690
    // Declare transformation matrix
692
691
    // Declare pointer to two dimensional array and initialise
720
719
    case 0:
721
720
      {
722
721
        
723
 
      // Array of basisvalues.
 
722
      // Array of basisvalues
724
723
      double basisvalues[1] = {0.0};
725
724
      
726
 
      // Declare helper variables.
 
725
      // Declare helper variables
727
726
      
728
 
      // Compute basisvalues.
 
727
      // Compute basisvalues
729
728
      basisvalues[0] = 1.0;
730
729
      
731
 
      // Table(s) of coefficients.
 
730
      // Table(s) of coefficients
732
731
      static const double coefficients0[1] = \
733
732
      {1.0};
734
733
      
852
851
    case 1:
853
852
      {
854
853
        
855
 
      // Array of basisvalues.
 
854
      // Array of basisvalues
856
855
      double basisvalues[1] = {0.0};
857
856
      
858
 
      // Declare helper variables.
 
857
      // Declare helper variables
859
858
      
860
 
      // Compute basisvalues.
 
859
      // Compute basisvalues
861
860
      basisvalues[0] = 1.0;
862
861
      
863
 
      // Table(s) of coefficients.
 
862
      // Table(s) of coefficients
864
863
      static const double coefficients0[1] = \
865
864
      {1.0};
866
865
      
985
984
    
986
985
  }
987
986
 
988
 
  /// Evaluate order n derivatives of all basis functions at given point in cell
989
 
  virtual void evaluate_basis_derivatives_all(unsigned int n,
 
987
  /// Evaluate order n derivatives of all basis functions at given point x in cell
 
988
  virtual void evaluate_basis_derivatives_all(std::size_t n,
990
989
                                              double* values,
991
 
                                              const double* coordinates,
992
 
                                              const ufc::cell& c) const
 
990
                                              const double* x,
 
991
                                              const double* vertex_coordinates,
 
992
                                              int cell_orientation) const
993
993
  {
994
994
    // Compute number of derivatives.
995
995
    unsigned int num_derivatives = 1;
1008
1008
    // Loop dofs and call evaluate_basis_derivatives.
1009
1009
    for (unsigned int r = 0; r < 2; r++)
1010
1010
    {
1011
 
      evaluate_basis_derivatives(r, n, dof_values, coordinates, c);
 
1011
      evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
1012
1012
      for (unsigned int s = 0; s < 2*num_derivatives; s++)
1013
1013
      {
1014
1014
        values[r*2*num_derivatives + s] = dof_values[s];
1020
1020
  }
1021
1021
 
1022
1022
  /// Evaluate linear functional for dof i on the function f
1023
 
  virtual double evaluate_dof(unsigned int i,
 
1023
  virtual double evaluate_dof(std::size_t i,
1024
1024
                              const ufc::function& f,
 
1025
                              const double* vertex_coordinates,
 
1026
                              int cell_orientation,
1025
1027
                              const ufc::cell& c) const
1026
1028
  {
1027
 
    // Declare variables for result of evaluation.
 
1029
    // Declare variables for result of evaluation
1028
1030
    double vals[2];
1029
1031
    
1030
 
    // Declare variable for physical coordinates.
 
1032
    // Declare variable for physical coordinates
1031
1033
    double y[2];
1032
 
    const double * const * x = c.coordinates;
1033
1034
    switch (i)
1034
1035
    {
1035
1036
    case 0:
1036
1037
      {
1037
 
        y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1038
 
      y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
1038
        y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
1039
      y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
1039
1040
      f.evaluate(vals, y, c);
1040
1041
      return vals[0];
1041
1042
        break;
1042
1043
      }
1043
1044
    case 1:
1044
1045
      {
1045
 
        y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1046
 
      y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
1046
        y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
1047
      y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
1047
1048
      f.evaluate(vals, y, c);
1048
1049
      return vals[1];
1049
1050
        break;
1056
1057
  /// Evaluate linear functionals for all dofs on the function f
1057
1058
  virtual void evaluate_dofs(double* values,
1058
1059
                             const ufc::function& f,
 
1060
                             const double* vertex_coordinates,
 
1061
                             int cell_orientation,
1059
1062
                             const ufc::cell& c) const
1060
1063
  {
1061
 
    // Declare variables for result of evaluation.
 
1064
    // Declare variables for result of evaluation
1062
1065
    double vals[2];
1063
1066
    
1064
 
    // Declare variable for physical coordinates.
 
1067
    // Declare variable for physical coordinates
1065
1068
    double y[2];
1066
 
    const double * const * x = c.coordinates;
1067
 
    y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1068
 
    y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
1069
    y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
1070
    y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
1069
1071
    f.evaluate(vals, y, c);
1070
1072
    values[0] = vals[0];
1071
 
    y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1072
 
    y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
1073
    y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
1074
    y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
1073
1075
    f.evaluate(vals, y, c);
1074
1076
    values[1] = vals[1];
1075
1077
  }
1077
1079
  /// Interpolate vertex values from dof values
1078
1080
  virtual void interpolate_vertex_values(double* vertex_values,
1079
1081
                                         const double* dof_values,
 
1082
                                         const double* vertex_coordinates,
 
1083
                                         int cell_orientation,
1080
1084
                                         const ufc::cell& c) const
1081
1085
  {
1082
1086
    // Evaluate function and change variables
1094
1098
                                       const double* xhat,
1095
1099
                                       const ufc::cell& c) const
1096
1100
  {
1097
 
    std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented (introduced in UFC 2.0)." << std::endl;
 
1101
    std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented." << std::endl;
1098
1102
  }
1099
1103
 
1100
1104
  /// Map from coordinate x in cell to coordinate xhat in reference cell
1102
1106
                                     const double* x,
1103
1107
                                     const ufc::cell& c) const
1104
1108
  {
1105
 
    std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented (introduced in UFC 2.0)." << std::endl;
 
1109
    std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented." << std::endl;
1106
1110
  }
1107
1111
 
1108
1112
  /// Return the number of sub elements (for a mixed element)
1109
 
  virtual unsigned int num_sub_elements() const
 
1113
  virtual std::size_t num_sub_elements() const
1110
1114
  {
1111
1115
    return 2;
1112
1116
  }
1113
1117
 
1114
1118
  /// Create a new finite element for sub element i (for a mixed element)
1115
 
  virtual ufc::finite_element* create_sub_element(unsigned int i) const
 
1119
  virtual ufc::finite_element* create_sub_element(std::size_t i) const
1116
1120
  {
1117
1121
    switch (i)
1118
1122
    {
1160
1164
  /// Return a string identifying the finite element
1161
1165
  virtual const char* signature() const
1162
1166
  {
1163
 
    return "FiniteElement('Lagrange', Cell('triangle', Space(2)), 2, None)";
 
1167
    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 2, None)";
1164
1168
  }
1165
1169
 
1166
1170
  /// Return the cell shape
1170
1174
  }
1171
1175
 
1172
1176
  /// Return the topological dimension of the cell shape
1173
 
  virtual unsigned int topological_dimension() const
 
1177
  virtual std::size_t topological_dimension() const
1174
1178
  {
1175
1179
    return 2;
1176
1180
  }
1177
1181
 
1178
1182
  /// Return the geometric dimension of the cell shape
1179
 
  virtual unsigned int geometric_dimension() const
 
1183
  virtual std::size_t geometric_dimension() const
1180
1184
  {
1181
1185
    return 2;
1182
1186
  }
1183
1187
 
1184
1188
  /// Return the dimension of the finite element function space
1185
 
  virtual unsigned int space_dimension() const
 
1189
  virtual std::size_t space_dimension() const
1186
1190
  {
1187
1191
    return 6;
1188
1192
  }
1189
1193
 
1190
1194
  /// Return the rank of the value space
1191
 
  virtual unsigned int value_rank() const
 
1195
  virtual std::size_t value_rank() const
1192
1196
  {
1193
1197
    return 0;
1194
1198
  }
1195
1199
 
1196
1200
  /// Return the dimension of the value space for axis i
1197
 
  virtual unsigned int value_dimension(unsigned int i) const
 
1201
  virtual std::size_t value_dimension(std::size_t i) const
1198
1202
  {
1199
1203
    return 1;
1200
1204
  }
1201
1205
 
1202
 
  /// Evaluate basis function i at given point in cell
1203
 
  virtual void evaluate_basis(unsigned int i,
 
1206
  /// Evaluate basis function i at given point x in cell
 
1207
  virtual void evaluate_basis(std::size_t i,
1204
1208
                              double* values,
1205
 
                              const double* coordinates,
1206
 
                              const ufc::cell& c) const
 
1209
                              const double* x,
 
1210
                              const double* vertex_coordinates,
 
1211
                              int cell_orientation) const
1207
1212
  {
1208
 
    // Extract vertex coordinates
1209
 
    const double * const * x = c.coordinates;
1210
 
    
1211
 
    // Compute Jacobian of affine map from reference cell
1212
 
    const double J_00 = x[1][0] - x[0][0];
1213
 
    const double J_01 = x[2][0] - x[0][0];
1214
 
    const double J_10 = x[1][1] - x[0][1];
1215
 
    const double J_11 = x[2][1] - x[0][1];
1216
 
    
1217
 
    // Compute determinant of Jacobian
1218
 
    double detJ = J_00*J_11 - J_01*J_10;
1219
 
    
1220
 
    // Compute inverse of Jacobian
 
1213
    // Compute Jacobian
 
1214
    double J[4];
 
1215
    compute_jacobian_triangle_2d(J, vertex_coordinates);
 
1216
    
 
1217
    // Compute Jacobian inverse and determinant
 
1218
    double K[4];
 
1219
    double detJ;
 
1220
    compute_jacobian_inverse_triangle_2d(K, detJ, J);
 
1221
    
1221
1222
    
1222
1223
    // Compute constants
1223
 
    const double C0 = x[1][0] + x[2][0];
1224
 
    const double C1 = x[1][1] + x[2][1];
 
1224
    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
 
1225
    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
1225
1226
    
1226
1227
    // Get coordinates and map to the reference (FIAT) element
1227
 
    double X = (J_01*(C1 - 2.0*coordinates[1]) + J_11*(2.0*coordinates[0] - C0)) / detJ;
1228
 
    double Y = (J_00*(2.0*coordinates[1] - C1) + J_10*(C0 - 2.0*coordinates[0])) / detJ;
 
1228
    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
 
1229
    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
1229
1230
    
1230
 
    // Reset values.
 
1231
    // Reset values
1231
1232
    *values = 0.0;
1232
1233
    switch (i)
1233
1234
    {
1234
1235
    case 0:
1235
1236
      {
1236
1237
        
1237
 
      // Array of basisvalues.
 
1238
      // Array of basisvalues
1238
1239
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
1239
1240
      
1240
 
      // Declare helper variables.
 
1241
      // Declare helper variables
1241
1242
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
1242
1243
      double tmp1 = (1.0 - Y)/2.0;
1243
1244
      double tmp2 = tmp1*tmp1;
1244
1245
      
1245
 
      // Compute basisvalues.
 
1246
      // Compute basisvalues
1246
1247
      basisvalues[0] = 1.0;
1247
1248
      basisvalues[1] = tmp0;
1248
1249
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
1256
1257
      basisvalues[4] *= std::sqrt(4.5);
1257
1258
      basisvalues[3] *= std::sqrt(7.5);
1258
1259
      
1259
 
      // Table(s) of coefficients.
 
1260
      // Table(s) of coefficients
1260
1261
      static const double coefficients0[6] = \
1261
1262
      {0.0, -0.17320508, -0.1, 0.12171612, 0.094280904, 0.054433105};
1262
1263
      
1263
 
      // Compute value(s).
 
1264
      // Compute value(s)
1264
1265
      for (unsigned int r = 0; r < 6; r++)
1265
1266
      {
1266
1267
        *values += coefficients0[r]*basisvalues[r];
1270
1271
    case 1:
1271
1272
      {
1272
1273
        
1273
 
      // Array of basisvalues.
 
1274
      // Array of basisvalues
1274
1275
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
1275
1276
      
1276
 
      // Declare helper variables.
 
1277
      // Declare helper variables
1277
1278
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
1278
1279
      double tmp1 = (1.0 - Y)/2.0;
1279
1280
      double tmp2 = tmp1*tmp1;
1280
1281
      
1281
 
      // Compute basisvalues.
 
1282
      // Compute basisvalues
1282
1283
      basisvalues[0] = 1.0;
1283
1284
      basisvalues[1] = tmp0;
1284
1285
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
1292
1293
      basisvalues[4] *= std::sqrt(4.5);
1293
1294
      basisvalues[3] *= std::sqrt(7.5);
1294
1295
      
1295
 
      // Table(s) of coefficients.
 
1296
      // Table(s) of coefficients
1296
1297
      static const double coefficients0[6] = \
1297
1298
      {0.0, 0.17320508, -0.1, 0.12171612, -0.094280904, 0.054433105};
1298
1299
      
1299
 
      // Compute value(s).
 
1300
      // Compute value(s)
1300
1301
      for (unsigned int r = 0; r < 6; r++)
1301
1302
      {
1302
1303
        *values += coefficients0[r]*basisvalues[r];
1306
1307
    case 2:
1307
1308
      {
1308
1309
        
1309
 
      // Array of basisvalues.
 
1310
      // Array of basisvalues
1310
1311
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
1311
1312
      
1312
 
      // Declare helper variables.
 
1313
      // Declare helper variables
1313
1314
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
1314
1315
      double tmp1 = (1.0 - Y)/2.0;
1315
1316
      double tmp2 = tmp1*tmp1;
1316
1317
      
1317
 
      // Compute basisvalues.
 
1318
      // Compute basisvalues
1318
1319
      basisvalues[0] = 1.0;
1319
1320
      basisvalues[1] = tmp0;
1320
1321
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
1328
1329
      basisvalues[4] *= std::sqrt(4.5);
1329
1330
      basisvalues[3] *= std::sqrt(7.5);
1330
1331
      
1331
 
      // Table(s) of coefficients.
 
1332
      // Table(s) of coefficients
1332
1333
      static const double coefficients0[6] = \
1333
1334
      {0.0, 0.0, 0.2, 0.0, 0.0, 0.16329932};
1334
1335
      
1335
 
      // Compute value(s).
 
1336
      // Compute value(s)
1336
1337
      for (unsigned int r = 0; r < 6; r++)
1337
1338
      {
1338
1339
        *values += coefficients0[r]*basisvalues[r];
1342
1343
    case 3:
1343
1344
      {
1344
1345
        
1345
 
      // Array of basisvalues.
 
1346
      // Array of basisvalues
1346
1347
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
1347
1348
      
1348
 
      // Declare helper variables.
 
1349
      // Declare helper variables
1349
1350
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
1350
1351
      double tmp1 = (1.0 - Y)/2.0;
1351
1352
      double tmp2 = tmp1*tmp1;
1352
1353
      
1353
 
      // Compute basisvalues.
 
1354
      // Compute basisvalues
1354
1355
      basisvalues[0] = 1.0;
1355
1356
      basisvalues[1] = tmp0;
1356
1357
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
1364
1365
      basisvalues[4] *= std::sqrt(4.5);
1365
1366
      basisvalues[3] *= std::sqrt(7.5);
1366
1367
      
1367
 
      // Table(s) of coefficients.
 
1368
      // Table(s) of coefficients
1368
1369
      static const double coefficients0[6] = \
1369
1370
      {0.47140452, 0.23094011, 0.13333333, 0.0, 0.18856181, -0.16329932};
1370
1371
      
1371
 
      // Compute value(s).
 
1372
      // Compute value(s)
1372
1373
      for (unsigned int r = 0; r < 6; r++)
1373
1374
      {
1374
1375
        *values += coefficients0[r]*basisvalues[r];
1378
1379
    case 4:
1379
1380
      {
1380
1381
        
1381
 
      // Array of basisvalues.
 
1382
      // Array of basisvalues
1382
1383
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
1383
1384
      
1384
 
      // Declare helper variables.
 
1385
      // Declare helper variables
1385
1386
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
1386
1387
      double tmp1 = (1.0 - Y)/2.0;
1387
1388
      double tmp2 = tmp1*tmp1;
1388
1389
      
1389
 
      // Compute basisvalues.
 
1390
      // Compute basisvalues
1390
1391
      basisvalues[0] = 1.0;
1391
1392
      basisvalues[1] = tmp0;
1392
1393
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
1400
1401
      basisvalues[4] *= std::sqrt(4.5);
1401
1402
      basisvalues[3] *= std::sqrt(7.5);
1402
1403
      
1403
 
      // Table(s) of coefficients.
 
1404
      // Table(s) of coefficients
1404
1405
      static const double coefficients0[6] = \
1405
1406
      {0.47140452, -0.23094011, 0.13333333, 0.0, -0.18856181, -0.16329932};
1406
1407
      
1407
 
      // Compute value(s).
 
1408
      // Compute value(s)
1408
1409
      for (unsigned int r = 0; r < 6; r++)
1409
1410
      {
1410
1411
        *values += coefficients0[r]*basisvalues[r];
1414
1415
    case 5:
1415
1416
      {
1416
1417
        
1417
 
      // Array of basisvalues.
 
1418
      // Array of basisvalues
1418
1419
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
1419
1420
      
1420
 
      // Declare helper variables.
 
1421
      // Declare helper variables
1421
1422
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
1422
1423
      double tmp1 = (1.0 - Y)/2.0;
1423
1424
      double tmp2 = tmp1*tmp1;
1424
1425
      
1425
 
      // Compute basisvalues.
 
1426
      // Compute basisvalues
1426
1427
      basisvalues[0] = 1.0;
1427
1428
      basisvalues[1] = tmp0;
1428
1429
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
1436
1437
      basisvalues[4] *= std::sqrt(4.5);
1437
1438
      basisvalues[3] *= std::sqrt(7.5);
1438
1439
      
1439
 
      // Table(s) of coefficients.
 
1440
      // Table(s) of coefficients
1440
1441
      static const double coefficients0[6] = \
1441
1442
      {0.47140452, 0.0, -0.26666667, -0.24343225, 0.0, 0.054433105};
1442
1443
      
1443
 
      // Compute value(s).
 
1444
      // Compute value(s)
1444
1445
      for (unsigned int r = 0; r < 6; r++)
1445
1446
      {
1446
1447
        *values += coefficients0[r]*basisvalues[r];
1451
1452
    
1452
1453
  }
1453
1454
 
1454
 
  /// Evaluate all basis functions at given point in cell
 
1455
  /// Evaluate all basis functions at given point x in cell
1455
1456
  virtual void evaluate_basis_all(double* values,
1456
 
                                  const double* coordinates,
1457
 
                                  const ufc::cell& c) const
 
1457
                                  const double* x,
 
1458
                                  const double* vertex_coordinates,
 
1459
                                  int cell_orientation) const
1458
1460
  {
1459
1461
    // Helper variable to hold values of a single dof.
1460
1462
    double dof_values = 0.0;
1461
1463
    
1462
 
    // Loop dofs and call evaluate_basis.
 
1464
    // Loop dofs and call evaluate_basis
1463
1465
    for (unsigned int r = 0; r < 6; r++)
1464
1466
    {
1465
 
      evaluate_basis(r, &dof_values, coordinates, c);
 
1467
      evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
1466
1468
      values[r] = dof_values;
1467
1469
    }// end loop over 'r'
1468
1470
  }
1469
1471
 
1470
 
  /// Evaluate order n derivatives of basis function i at given point in cell
1471
 
  virtual void evaluate_basis_derivatives(unsigned int i,
1472
 
                                          unsigned int n,
 
1472
  /// Evaluate order n derivatives of basis function i at given point x in cell
 
1473
  virtual void evaluate_basis_derivatives(std::size_t i,
 
1474
                                          std::size_t n,
1473
1475
                                          double* values,
1474
 
                                          const double* coordinates,
1475
 
                                          const ufc::cell& c) const
 
1476
                                          const double* x,
 
1477
                                          const double* vertex_coordinates,
 
1478
                                          int cell_orientation) const
1476
1479
  {
1477
 
    // Extract vertex coordinates
1478
 
    const double * const * x = c.coordinates;
1479
 
    
1480
 
    // Compute Jacobian of affine map from reference cell
1481
 
    const double J_00 = x[1][0] - x[0][0];
1482
 
    const double J_01 = x[2][0] - x[0][0];
1483
 
    const double J_10 = x[1][1] - x[0][1];
1484
 
    const double J_11 = x[2][1] - x[0][1];
1485
 
    
1486
 
    // Compute determinant of Jacobian
1487
 
    double detJ = J_00*J_11 - J_01*J_10;
1488
 
    
1489
 
    // Compute inverse of Jacobian
1490
 
    const double K_00 =  J_11 / detJ;
1491
 
    const double K_01 = -J_01 / detJ;
1492
 
    const double K_10 = -J_10 / detJ;
1493
 
    const double K_11 =  J_00 / detJ;
 
1480
    // Compute Jacobian
 
1481
    double J[4];
 
1482
    compute_jacobian_triangle_2d(J, vertex_coordinates);
 
1483
    
 
1484
    // Compute Jacobian inverse and determinant
 
1485
    double K[4];
 
1486
    double detJ;
 
1487
    compute_jacobian_inverse_triangle_2d(K, detJ, J);
 
1488
    
1494
1489
    
1495
1490
    // Compute constants
1496
 
    const double C0 = x[1][0] + x[2][0];
1497
 
    const double C1 = x[1][1] + x[2][1];
 
1491
    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
 
1492
    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
1498
1493
    
1499
1494
    // Get coordinates and map to the reference (FIAT) element
1500
 
    double X = (J_01*(C1 - 2.0*coordinates[1]) + J_11*(2.0*coordinates[0] - C0)) / detJ;
1501
 
    double Y = (J_00*(2.0*coordinates[1] - C1) + J_10*(C0 - 2.0*coordinates[0])) / detJ;
 
1495
    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
 
1496
    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
1502
1497
    
1503
1498
    // Compute number of derivatives.
1504
1499
    unsigned int num_derivatives = 1;
1535
1530
    }
1536
1531
    
1537
1532
    // Compute inverse of Jacobian
1538
 
    const double Jinv[2][2] = {{K_00, K_01}, {K_10, K_11}};
 
1533
    const double Jinv[2][2] = {{K[0], K[1]}, {K[2], K[3]}};
1539
1534
    
1540
1535
    // Declare transformation matrix
1541
1536
    // Declare pointer to two dimensional array and initialise
1569
1564
    case 0:
1570
1565
      {
1571
1566
        
1572
 
      // Array of basisvalues.
 
1567
      // Array of basisvalues
1573
1568
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
1574
1569
      
1575
 
      // Declare helper variables.
 
1570
      // Declare helper variables
1576
1571
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
1577
1572
      double tmp1 = (1.0 - Y)/2.0;
1578
1573
      double tmp2 = tmp1*tmp1;
1579
1574
      
1580
 
      // Compute basisvalues.
 
1575
      // Compute basisvalues
1581
1576
      basisvalues[0] = 1.0;
1582
1577
      basisvalues[1] = tmp0;
1583
1578
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
1591
1586
      basisvalues[4] *= std::sqrt(4.5);
1592
1587
      basisvalues[3] *= std::sqrt(7.5);
1593
1588
      
1594
 
      // Table(s) of coefficients.
 
1589
      // Table(s) of coefficients
1595
1590
      static const double coefficients0[6] = \
1596
1591
      {0.0, -0.17320508, -0.1, 0.12171612, 0.094280904, 0.054433105};
1597
1592
      
1735
1730
    case 1:
1736
1731
      {
1737
1732
        
1738
 
      // Array of basisvalues.
 
1733
      // Array of basisvalues
1739
1734
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
1740
1735
      
1741
 
      // Declare helper variables.
 
1736
      // Declare helper variables
1742
1737
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
1743
1738
      double tmp1 = (1.0 - Y)/2.0;
1744
1739
      double tmp2 = tmp1*tmp1;
1745
1740
      
1746
 
      // Compute basisvalues.
 
1741
      // Compute basisvalues
1747
1742
      basisvalues[0] = 1.0;
1748
1743
      basisvalues[1] = tmp0;
1749
1744
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
1757
1752
      basisvalues[4] *= std::sqrt(4.5);
1758
1753
      basisvalues[3] *= std::sqrt(7.5);
1759
1754
      
1760
 
      // Table(s) of coefficients.
 
1755
      // Table(s) of coefficients
1761
1756
      static const double coefficients0[6] = \
1762
1757
      {0.0, 0.17320508, -0.1, 0.12171612, -0.094280904, 0.054433105};
1763
1758
      
1901
1896
    case 2:
1902
1897
      {
1903
1898
        
1904
 
      // Array of basisvalues.
 
1899
      // Array of basisvalues
1905
1900
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
1906
1901
      
1907
 
      // Declare helper variables.
 
1902
      // Declare helper variables
1908
1903
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
1909
1904
      double tmp1 = (1.0 - Y)/2.0;
1910
1905
      double tmp2 = tmp1*tmp1;
1911
1906
      
1912
 
      // Compute basisvalues.
 
1907
      // Compute basisvalues
1913
1908
      basisvalues[0] = 1.0;
1914
1909
      basisvalues[1] = tmp0;
1915
1910
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
1923
1918
      basisvalues[4] *= std::sqrt(4.5);
1924
1919
      basisvalues[3] *= std::sqrt(7.5);
1925
1920
      
1926
 
      // Table(s) of coefficients.
 
1921
      // Table(s) of coefficients
1927
1922
      static const double coefficients0[6] = \
1928
1923
      {0.0, 0.0, 0.2, 0.0, 0.0, 0.16329932};
1929
1924
      
2067
2062
    case 3:
2068
2063
      {
2069
2064
        
2070
 
      // Array of basisvalues.
 
2065
      // Array of basisvalues
2071
2066
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
2072
2067
      
2073
 
      // Declare helper variables.
 
2068
      // Declare helper variables
2074
2069
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
2075
2070
      double tmp1 = (1.0 - Y)/2.0;
2076
2071
      double tmp2 = tmp1*tmp1;
2077
2072
      
2078
 
      // Compute basisvalues.
 
2073
      // Compute basisvalues
2079
2074
      basisvalues[0] = 1.0;
2080
2075
      basisvalues[1] = tmp0;
2081
2076
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
2089
2084
      basisvalues[4] *= std::sqrt(4.5);
2090
2085
      basisvalues[3] *= std::sqrt(7.5);
2091
2086
      
2092
 
      // Table(s) of coefficients.
 
2087
      // Table(s) of coefficients
2093
2088
      static const double coefficients0[6] = \
2094
2089
      {0.47140452, 0.23094011, 0.13333333, 0.0, 0.18856181, -0.16329932};
2095
2090
      
2233
2228
    case 4:
2234
2229
      {
2235
2230
        
2236
 
      // Array of basisvalues.
 
2231
      // Array of basisvalues
2237
2232
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
2238
2233
      
2239
 
      // Declare helper variables.
 
2234
      // Declare helper variables
2240
2235
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
2241
2236
      double tmp1 = (1.0 - Y)/2.0;
2242
2237
      double tmp2 = tmp1*tmp1;
2243
2238
      
2244
 
      // Compute basisvalues.
 
2239
      // Compute basisvalues
2245
2240
      basisvalues[0] = 1.0;
2246
2241
      basisvalues[1] = tmp0;
2247
2242
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
2255
2250
      basisvalues[4] *= std::sqrt(4.5);
2256
2251
      basisvalues[3] *= std::sqrt(7.5);
2257
2252
      
2258
 
      // Table(s) of coefficients.
 
2253
      // Table(s) of coefficients
2259
2254
      static const double coefficients0[6] = \
2260
2255
      {0.47140452, -0.23094011, 0.13333333, 0.0, -0.18856181, -0.16329932};
2261
2256
      
2399
2394
    case 5:
2400
2395
      {
2401
2396
        
2402
 
      // Array of basisvalues.
 
2397
      // Array of basisvalues
2403
2398
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
2404
2399
      
2405
 
      // Declare helper variables.
 
2400
      // Declare helper variables
2406
2401
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
2407
2402
      double tmp1 = (1.0 - Y)/2.0;
2408
2403
      double tmp2 = tmp1*tmp1;
2409
2404
      
2410
 
      // Compute basisvalues.
 
2405
      // Compute basisvalues
2411
2406
      basisvalues[0] = 1.0;
2412
2407
      basisvalues[1] = tmp0;
2413
2408
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
2421
2416
      basisvalues[4] *= std::sqrt(4.5);
2422
2417
      basisvalues[3] *= std::sqrt(7.5);
2423
2418
      
2424
 
      // Table(s) of coefficients.
 
2419
      // Table(s) of coefficients
2425
2420
      static const double coefficients0[6] = \
2426
2421
      {0.47140452, 0.0, -0.26666667, -0.24343225, 0.0, 0.054433105};
2427
2422
      
2566
2561
    
2567
2562
  }
2568
2563
 
2569
 
  /// Evaluate order n derivatives of all basis functions at given point in cell
2570
 
  virtual void evaluate_basis_derivatives_all(unsigned int n,
 
2564
  /// Evaluate order n derivatives of all basis functions at given point x in cell
 
2565
  virtual void evaluate_basis_derivatives_all(std::size_t n,
2571
2566
                                              double* values,
2572
 
                                              const double* coordinates,
2573
 
                                              const ufc::cell& c) const
 
2567
                                              const double* x,
 
2568
                                              const double* vertex_coordinates,
 
2569
                                              int cell_orientation) const
2574
2570
  {
2575
2571
    // Compute number of derivatives.
2576
2572
    unsigned int num_derivatives = 1;
2589
2585
    // Loop dofs and call evaluate_basis_derivatives.
2590
2586
    for (unsigned int r = 0; r < 6; r++)
2591
2587
    {
2592
 
      evaluate_basis_derivatives(r, n, dof_values, coordinates, c);
 
2588
      evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
2593
2589
      for (unsigned int s = 0; s < num_derivatives; s++)
2594
2590
      {
2595
2591
        values[r*num_derivatives + s] = dof_values[s];
2601
2597
  }
2602
2598
 
2603
2599
  /// Evaluate linear functional for dof i on the function f
2604
 
  virtual double evaluate_dof(unsigned int i,
 
2600
  virtual double evaluate_dof(std::size_t i,
2605
2601
                              const ufc::function& f,
 
2602
                              const double* vertex_coordinates,
 
2603
                              int cell_orientation,
2606
2604
                              const ufc::cell& c) const
2607
2605
  {
2608
 
    // Declare variables for result of evaluation.
 
2606
    // Declare variables for result of evaluation
2609
2607
    double vals[1];
2610
2608
    
2611
 
    // Declare variable for physical coordinates.
 
2609
    // Declare variable for physical coordinates
2612
2610
    double y[2];
2613
 
    const double * const * x = c.coordinates;
2614
2611
    switch (i)
2615
2612
    {
2616
2613
    case 0:
2617
2614
      {
2618
 
        y[0] = x[0][0];
2619
 
      y[1] = x[0][1];
 
2615
        y[0] = vertex_coordinates[0];
 
2616
      y[1] = vertex_coordinates[1];
2620
2617
      f.evaluate(vals, y, c);
2621
2618
      return vals[0];
2622
2619
        break;
2623
2620
      }
2624
2621
    case 1:
2625
2622
      {
2626
 
        y[0] = x[1][0];
2627
 
      y[1] = x[1][1];
 
2623
        y[0] = vertex_coordinates[2];
 
2624
      y[1] = vertex_coordinates[3];
2628
2625
      f.evaluate(vals, y, c);
2629
2626
      return vals[0];
2630
2627
        break;
2631
2628
      }
2632
2629
    case 2:
2633
2630
      {
2634
 
        y[0] = x[2][0];
2635
 
      y[1] = x[2][1];
 
2631
        y[0] = vertex_coordinates[4];
 
2632
      y[1] = vertex_coordinates[5];
2636
2633
      f.evaluate(vals, y, c);
2637
2634
      return vals[0];
2638
2635
        break;
2639
2636
      }
2640
2637
    case 3:
2641
2638
      {
2642
 
        y[0] = 0.5*x[1][0] + 0.5*x[2][0];
2643
 
      y[1] = 0.5*x[1][1] + 0.5*x[2][1];
 
2639
        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
2640
      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
2644
2641
      f.evaluate(vals, y, c);
2645
2642
      return vals[0];
2646
2643
        break;
2647
2644
      }
2648
2645
    case 4:
2649
2646
      {
2650
 
        y[0] = 0.5*x[0][0] + 0.5*x[2][0];
2651
 
      y[1] = 0.5*x[0][1] + 0.5*x[2][1];
 
2647
        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
 
2648
      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
2652
2649
      f.evaluate(vals, y, c);
2653
2650
      return vals[0];
2654
2651
        break;
2655
2652
      }
2656
2653
    case 5:
2657
2654
      {
2658
 
        y[0] = 0.5*x[0][0] + 0.5*x[1][0];
2659
 
      y[1] = 0.5*x[0][1] + 0.5*x[1][1];
 
2655
        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
 
2656
      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
2660
2657
      f.evaluate(vals, y, c);
2661
2658
      return vals[0];
2662
2659
        break;
2669
2666
  /// Evaluate linear functionals for all dofs on the function f
2670
2667
  virtual void evaluate_dofs(double* values,
2671
2668
                             const ufc::function& f,
 
2669
                             const double* vertex_coordinates,
 
2670
                             int cell_orientation,
2672
2671
                             const ufc::cell& c) const
2673
2672
  {
2674
 
    // Declare variables for result of evaluation.
 
2673
    // Declare variables for result of evaluation
2675
2674
    double vals[1];
2676
2675
    
2677
 
    // Declare variable for physical coordinates.
 
2676
    // Declare variable for physical coordinates
2678
2677
    double y[2];
2679
 
    const double * const * x = c.coordinates;
2680
 
    y[0] = x[0][0];
2681
 
    y[1] = x[0][1];
 
2678
    y[0] = vertex_coordinates[0];
 
2679
    y[1] = vertex_coordinates[1];
2682
2680
    f.evaluate(vals, y, c);
2683
2681
    values[0] = vals[0];
2684
 
    y[0] = x[1][0];
2685
 
    y[1] = x[1][1];
 
2682
    y[0] = vertex_coordinates[2];
 
2683
    y[1] = vertex_coordinates[3];
2686
2684
    f.evaluate(vals, y, c);
2687
2685
    values[1] = vals[0];
2688
 
    y[0] = x[2][0];
2689
 
    y[1] = x[2][1];
 
2686
    y[0] = vertex_coordinates[4];
 
2687
    y[1] = vertex_coordinates[5];
2690
2688
    f.evaluate(vals, y, c);
2691
2689
    values[2] = vals[0];
2692
 
    y[0] = 0.5*x[1][0] + 0.5*x[2][0];
2693
 
    y[1] = 0.5*x[1][1] + 0.5*x[2][1];
 
2690
    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
2691
    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
2694
2692
    f.evaluate(vals, y, c);
2695
2693
    values[3] = vals[0];
2696
 
    y[0] = 0.5*x[0][0] + 0.5*x[2][0];
2697
 
    y[1] = 0.5*x[0][1] + 0.5*x[2][1];
 
2694
    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
 
2695
    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
2698
2696
    f.evaluate(vals, y, c);
2699
2697
    values[4] = vals[0];
2700
 
    y[0] = 0.5*x[0][0] + 0.5*x[1][0];
2701
 
    y[1] = 0.5*x[0][1] + 0.5*x[1][1];
 
2698
    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
 
2699
    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
2702
2700
    f.evaluate(vals, y, c);
2703
2701
    values[5] = vals[0];
2704
2702
  }
2706
2704
  /// Interpolate vertex values from dof values
2707
2705
  virtual void interpolate_vertex_values(double* vertex_values,
2708
2706
                                         const double* dof_values,
 
2707
                                         const double* vertex_coordinates,
 
2708
                                         int cell_orientation,
2709
2709
                                         const ufc::cell& c) const
2710
2710
  {
2711
2711
    // Evaluate function and change variables
2719
2719
                                       const double* xhat,
2720
2720
                                       const ufc::cell& c) const
2721
2721
  {
2722
 
    std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented (introduced in UFC 2.0)." << std::endl;
 
2722
    std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented." << std::endl;
2723
2723
  }
2724
2724
 
2725
2725
  /// Map from coordinate x in cell to coordinate xhat in reference cell
2727
2727
                                     const double* x,
2728
2728
                                     const ufc::cell& c) const
2729
2729
  {
2730
 
    std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented (introduced in UFC 2.0)." << std::endl;
 
2730
    std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented." << std::endl;
2731
2731
  }
2732
2732
 
2733
2733
  /// Return the number of sub elements (for a mixed element)
2734
 
  virtual unsigned int num_sub_elements() const
 
2734
  virtual std::size_t num_sub_elements() const
2735
2735
  {
2736
2736
    return 0;
2737
2737
  }
2738
2738
 
2739
2739
  /// Create a new finite element for sub element i (for a mixed element)
2740
 
  virtual ufc::finite_element* create_sub_element(unsigned int i) const
 
2740
  virtual ufc::finite_element* create_sub_element(std::size_t i) const
2741
2741
  {
2742
2742
    return 0;
2743
2743
  }
2771
2771
  /// Return a string identifying the finite element
2772
2772
  virtual const char* signature() const
2773
2773
  {
2774
 
    return "MixedElement(*[VectorElement('Discontinuous Lagrange', Cell('triangle', Space(2)), 0, 2, None), FiniteElement('Lagrange', Cell('triangle', Space(2)), 2, None)], **{'value_shape': (3,) })";
 
2774
    return "MixedElement(*[VectorElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 0, 2, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 2, None)], **{'value_shape': (3,) })";
2775
2775
  }
2776
2776
 
2777
2777
  /// Return the cell shape
2781
2781
  }
2782
2782
 
2783
2783
  /// Return the topological dimension of the cell shape
2784
 
  virtual unsigned int topological_dimension() const
 
2784
  virtual std::size_t topological_dimension() const
2785
2785
  {
2786
2786
    return 2;
2787
2787
  }
2788
2788
 
2789
2789
  /// Return the geometric dimension of the cell shape
2790
 
  virtual unsigned int geometric_dimension() const
 
2790
  virtual std::size_t geometric_dimension() const
2791
2791
  {
2792
2792
    return 2;
2793
2793
  }
2794
2794
 
2795
2795
  /// Return the dimension of the finite element function space
2796
 
  virtual unsigned int space_dimension() const
 
2796
  virtual std::size_t space_dimension() const
2797
2797
  {
2798
2798
    return 8;
2799
2799
  }
2800
2800
 
2801
2801
  /// Return the rank of the value space
2802
 
  virtual unsigned int value_rank() const
 
2802
  virtual std::size_t value_rank() const
2803
2803
  {
2804
2804
    return 1;
2805
2805
  }
2806
2806
 
2807
2807
  /// Return the dimension of the value space for axis i
2808
 
  virtual unsigned int value_dimension(unsigned int i) const
 
2808
  virtual std::size_t value_dimension(std::size_t i) const
2809
2809
  {
2810
2810
    switch (i)
2811
2811
    {
2819
2819
    return 0;
2820
2820
  }
2821
2821
 
2822
 
  /// Evaluate basis function i at given point in cell
2823
 
  virtual void evaluate_basis(unsigned int i,
 
2822
  /// Evaluate basis function i at given point x in cell
 
2823
  virtual void evaluate_basis(std::size_t i,
2824
2824
                              double* values,
2825
 
                              const double* coordinates,
2826
 
                              const ufc::cell& c) const
 
2825
                              const double* x,
 
2826
                              const double* vertex_coordinates,
 
2827
                              int cell_orientation) const
2827
2828
  {
2828
 
    // Extract vertex coordinates
2829
 
    const double * const * x = c.coordinates;
2830
 
    
2831
 
    // Compute Jacobian of affine map from reference cell
2832
 
    const double J_00 = x[1][0] - x[0][0];
2833
 
    const double J_01 = x[2][0] - x[0][0];
2834
 
    const double J_10 = x[1][1] - x[0][1];
2835
 
    const double J_11 = x[2][1] - x[0][1];
2836
 
    
2837
 
    // Compute determinant of Jacobian
2838
 
    double detJ = J_00*J_11 - J_01*J_10;
2839
 
    
2840
 
    // Compute inverse of Jacobian
 
2829
    // Compute Jacobian
 
2830
    double J[4];
 
2831
    compute_jacobian_triangle_2d(J, vertex_coordinates);
 
2832
    
 
2833
    // Compute Jacobian inverse and determinant
 
2834
    double K[4];
 
2835
    double detJ;
 
2836
    compute_jacobian_inverse_triangle_2d(K, detJ, J);
 
2837
    
2841
2838
    
2842
2839
    // Compute constants
2843
 
    const double C0 = x[1][0] + x[2][0];
2844
 
    const double C1 = x[1][1] + x[2][1];
 
2840
    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
 
2841
    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
2845
2842
    
2846
2843
    // Get coordinates and map to the reference (FIAT) element
2847
 
    double X = (J_01*(C1 - 2.0*coordinates[1]) + J_11*(2.0*coordinates[0] - C0)) / detJ;
2848
 
    double Y = (J_00*(2.0*coordinates[1] - C1) + J_10*(C0 - 2.0*coordinates[0])) / detJ;
 
2844
    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
 
2845
    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
2849
2846
    
2850
 
    // Reset values.
 
2847
    // Reset values
2851
2848
    values[0] = 0.0;
2852
2849
    values[1] = 0.0;
2853
2850
    values[2] = 0.0;
2856
2853
    case 0:
2857
2854
      {
2858
2855
        
2859
 
      // Array of basisvalues.
 
2856
      // Array of basisvalues
2860
2857
      double basisvalues[1] = {0.0};
2861
2858
      
2862
 
      // Declare helper variables.
 
2859
      // Declare helper variables
2863
2860
      
2864
 
      // Compute basisvalues.
 
2861
      // Compute basisvalues
2865
2862
      basisvalues[0] = 1.0;
2866
2863
      
2867
 
      // Table(s) of coefficients.
 
2864
      // Table(s) of coefficients
2868
2865
      static const double coefficients0[1] = \
2869
2866
      {1.0};
2870
2867
      
2871
 
      // Compute value(s).
 
2868
      // Compute value(s)
2872
2869
      for (unsigned int r = 0; r < 1; r++)
2873
2870
      {
2874
2871
        values[0] += coefficients0[r]*basisvalues[r];
2878
2875
    case 1:
2879
2876
      {
2880
2877
        
2881
 
      // Array of basisvalues.
 
2878
      // Array of basisvalues
2882
2879
      double basisvalues[1] = {0.0};
2883
2880
      
2884
 
      // Declare helper variables.
 
2881
      // Declare helper variables
2885
2882
      
2886
 
      // Compute basisvalues.
 
2883
      // Compute basisvalues
2887
2884
      basisvalues[0] = 1.0;
2888
2885
      
2889
 
      // Table(s) of coefficients.
 
2886
      // Table(s) of coefficients
2890
2887
      static const double coefficients0[1] = \
2891
2888
      {1.0};
2892
2889
      
2893
 
      // Compute value(s).
 
2890
      // Compute value(s)
2894
2891
      for (unsigned int r = 0; r < 1; r++)
2895
2892
      {
2896
2893
        values[1] += coefficients0[r]*basisvalues[r];
2900
2897
    case 2:
2901
2898
      {
2902
2899
        
2903
 
      // Array of basisvalues.
 
2900
      // Array of basisvalues
2904
2901
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
2905
2902
      
2906
 
      // Declare helper variables.
 
2903
      // Declare helper variables
2907
2904
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
2908
2905
      double tmp1 = (1.0 - Y)/2.0;
2909
2906
      double tmp2 = tmp1*tmp1;
2910
2907
      
2911
 
      // Compute basisvalues.
 
2908
      // Compute basisvalues
2912
2909
      basisvalues[0] = 1.0;
2913
2910
      basisvalues[1] = tmp0;
2914
2911
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
2922
2919
      basisvalues[4] *= std::sqrt(4.5);
2923
2920
      basisvalues[3] *= std::sqrt(7.5);
2924
2921
      
2925
 
      // Table(s) of coefficients.
 
2922
      // Table(s) of coefficients
2926
2923
      static const double coefficients0[6] = \
2927
2924
      {0.0, -0.17320508, -0.1, 0.12171612, 0.094280904, 0.054433105};
2928
2925
      
2929
 
      // Compute value(s).
 
2926
      // Compute value(s)
2930
2927
      for (unsigned int r = 0; r < 6; r++)
2931
2928
      {
2932
2929
        values[2] += coefficients0[r]*basisvalues[r];
2936
2933
    case 3:
2937
2934
      {
2938
2935
        
2939
 
      // Array of basisvalues.
 
2936
      // Array of basisvalues
2940
2937
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
2941
2938
      
2942
 
      // Declare helper variables.
 
2939
      // Declare helper variables
2943
2940
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
2944
2941
      double tmp1 = (1.0 - Y)/2.0;
2945
2942
      double tmp2 = tmp1*tmp1;
2946
2943
      
2947
 
      // Compute basisvalues.
 
2944
      // Compute basisvalues
2948
2945
      basisvalues[0] = 1.0;
2949
2946
      basisvalues[1] = tmp0;
2950
2947
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
2958
2955
      basisvalues[4] *= std::sqrt(4.5);
2959
2956
      basisvalues[3] *= std::sqrt(7.5);
2960
2957
      
2961
 
      // Table(s) of coefficients.
 
2958
      // Table(s) of coefficients
2962
2959
      static const double coefficients0[6] = \
2963
2960
      {0.0, 0.17320508, -0.1, 0.12171612, -0.094280904, 0.054433105};
2964
2961
      
2965
 
      // Compute value(s).
 
2962
      // Compute value(s)
2966
2963
      for (unsigned int r = 0; r < 6; r++)
2967
2964
      {
2968
2965
        values[2] += coefficients0[r]*basisvalues[r];
2972
2969
    case 4:
2973
2970
      {
2974
2971
        
2975
 
      // Array of basisvalues.
 
2972
      // Array of basisvalues
2976
2973
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
2977
2974
      
2978
 
      // Declare helper variables.
 
2975
      // Declare helper variables
2979
2976
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
2980
2977
      double tmp1 = (1.0 - Y)/2.0;
2981
2978
      double tmp2 = tmp1*tmp1;
2982
2979
      
2983
 
      // Compute basisvalues.
 
2980
      // Compute basisvalues
2984
2981
      basisvalues[0] = 1.0;
2985
2982
      basisvalues[1] = tmp0;
2986
2983
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
2994
2991
      basisvalues[4] *= std::sqrt(4.5);
2995
2992
      basisvalues[3] *= std::sqrt(7.5);
2996
2993
      
2997
 
      // Table(s) of coefficients.
 
2994
      // Table(s) of coefficients
2998
2995
      static const double coefficients0[6] = \
2999
2996
      {0.0, 0.0, 0.2, 0.0, 0.0, 0.16329932};
3000
2997
      
3001
 
      // Compute value(s).
 
2998
      // Compute value(s)
3002
2999
      for (unsigned int r = 0; r < 6; r++)
3003
3000
      {
3004
3001
        values[2] += coefficients0[r]*basisvalues[r];
3008
3005
    case 5:
3009
3006
      {
3010
3007
        
3011
 
      // Array of basisvalues.
 
3008
      // Array of basisvalues
3012
3009
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
3013
3010
      
3014
 
      // Declare helper variables.
 
3011
      // Declare helper variables
3015
3012
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
3016
3013
      double tmp1 = (1.0 - Y)/2.0;
3017
3014
      double tmp2 = tmp1*tmp1;
3018
3015
      
3019
 
      // Compute basisvalues.
 
3016
      // Compute basisvalues
3020
3017
      basisvalues[0] = 1.0;
3021
3018
      basisvalues[1] = tmp0;
3022
3019
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
3030
3027
      basisvalues[4] *= std::sqrt(4.5);
3031
3028
      basisvalues[3] *= std::sqrt(7.5);
3032
3029
      
3033
 
      // Table(s) of coefficients.
 
3030
      // Table(s) of coefficients
3034
3031
      static const double coefficients0[6] = \
3035
3032
      {0.47140452, 0.23094011, 0.13333333, 0.0, 0.18856181, -0.16329932};
3036
3033
      
3037
 
      // Compute value(s).
 
3034
      // Compute value(s)
3038
3035
      for (unsigned int r = 0; r < 6; r++)
3039
3036
      {
3040
3037
        values[2] += coefficients0[r]*basisvalues[r];
3044
3041
    case 6:
3045
3042
      {
3046
3043
        
3047
 
      // Array of basisvalues.
 
3044
      // Array of basisvalues
3048
3045
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
3049
3046
      
3050
 
      // Declare helper variables.
 
3047
      // Declare helper variables
3051
3048
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
3052
3049
      double tmp1 = (1.0 - Y)/2.0;
3053
3050
      double tmp2 = tmp1*tmp1;
3054
3051
      
3055
 
      // Compute basisvalues.
 
3052
      // Compute basisvalues
3056
3053
      basisvalues[0] = 1.0;
3057
3054
      basisvalues[1] = tmp0;
3058
3055
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
3066
3063
      basisvalues[4] *= std::sqrt(4.5);
3067
3064
      basisvalues[3] *= std::sqrt(7.5);
3068
3065
      
3069
 
      // Table(s) of coefficients.
 
3066
      // Table(s) of coefficients
3070
3067
      static const double coefficients0[6] = \
3071
3068
      {0.47140452, -0.23094011, 0.13333333, 0.0, -0.18856181, -0.16329932};
3072
3069
      
3073
 
      // Compute value(s).
 
3070
      // Compute value(s)
3074
3071
      for (unsigned int r = 0; r < 6; r++)
3075
3072
      {
3076
3073
        values[2] += coefficients0[r]*basisvalues[r];
3080
3077
    case 7:
3081
3078
      {
3082
3079
        
3083
 
      // Array of basisvalues.
 
3080
      // Array of basisvalues
3084
3081
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
3085
3082
      
3086
 
      // Declare helper variables.
 
3083
      // Declare helper variables
3087
3084
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
3088
3085
      double tmp1 = (1.0 - Y)/2.0;
3089
3086
      double tmp2 = tmp1*tmp1;
3090
3087
      
3091
 
      // Compute basisvalues.
 
3088
      // Compute basisvalues
3092
3089
      basisvalues[0] = 1.0;
3093
3090
      basisvalues[1] = tmp0;
3094
3091
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
3102
3099
      basisvalues[4] *= std::sqrt(4.5);
3103
3100
      basisvalues[3] *= std::sqrt(7.5);
3104
3101
      
3105
 
      // Table(s) of coefficients.
 
3102
      // Table(s) of coefficients
3106
3103
      static const double coefficients0[6] = \
3107
3104
      {0.47140452, 0.0, -0.26666667, -0.24343225, 0.0, 0.054433105};
3108
3105
      
3109
 
      // Compute value(s).
 
3106
      // Compute value(s)
3110
3107
      for (unsigned int r = 0; r < 6; r++)
3111
3108
      {
3112
3109
        values[2] += coefficients0[r]*basisvalues[r];
3117
3114
    
3118
3115
  }
3119
3116
 
3120
 
  /// Evaluate all basis functions at given point in cell
 
3117
  /// Evaluate all basis functions at given point x in cell
3121
3118
  virtual void evaluate_basis_all(double* values,
3122
 
                                  const double* coordinates,
3123
 
                                  const ufc::cell& c) const
 
3119
                                  const double* x,
 
3120
                                  const double* vertex_coordinates,
 
3121
                                  int cell_orientation) const
3124
3122
  {
3125
3123
    // Helper variable to hold values of a single dof.
3126
3124
    double dof_values[3] = {0.0, 0.0, 0.0};
3127
3125
    
3128
 
    // Loop dofs and call evaluate_basis.
 
3126
    // Loop dofs and call evaluate_basis
3129
3127
    for (unsigned int r = 0; r < 8; r++)
3130
3128
    {
3131
 
      evaluate_basis(r, dof_values, coordinates, c);
 
3129
      evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
3132
3130
      for (unsigned int s = 0; s < 3; s++)
3133
3131
      {
3134
3132
        values[r*3 + s] = dof_values[s];
3136
3134
    }// end loop over 'r'
3137
3135
  }
3138
3136
 
3139
 
  /// Evaluate order n derivatives of basis function i at given point in cell
3140
 
  virtual void evaluate_basis_derivatives(unsigned int i,
3141
 
                                          unsigned int n,
 
3137
  /// Evaluate order n derivatives of basis function i at given point x in cell
 
3138
  virtual void evaluate_basis_derivatives(std::size_t i,
 
3139
                                          std::size_t n,
3142
3140
                                          double* values,
3143
 
                                          const double* coordinates,
3144
 
                                          const ufc::cell& c) const
 
3141
                                          const double* x,
 
3142
                                          const double* vertex_coordinates,
 
3143
                                          int cell_orientation) const
3145
3144
  {
3146
 
    // Extract vertex coordinates
3147
 
    const double * const * x = c.coordinates;
3148
 
    
3149
 
    // Compute Jacobian of affine map from reference cell
3150
 
    const double J_00 = x[1][0] - x[0][0];
3151
 
    const double J_01 = x[2][0] - x[0][0];
3152
 
    const double J_10 = x[1][1] - x[0][1];
3153
 
    const double J_11 = x[2][1] - x[0][1];
3154
 
    
3155
 
    // Compute determinant of Jacobian
3156
 
    double detJ = J_00*J_11 - J_01*J_10;
3157
 
    
3158
 
    // Compute inverse of Jacobian
3159
 
    const double K_00 =  J_11 / detJ;
3160
 
    const double K_01 = -J_01 / detJ;
3161
 
    const double K_10 = -J_10 / detJ;
3162
 
    const double K_11 =  J_00 / detJ;
 
3145
    // Compute Jacobian
 
3146
    double J[4];
 
3147
    compute_jacobian_triangle_2d(J, vertex_coordinates);
 
3148
    
 
3149
    // Compute Jacobian inverse and determinant
 
3150
    double K[4];
 
3151
    double detJ;
 
3152
    compute_jacobian_inverse_triangle_2d(K, detJ, J);
 
3153
    
3163
3154
    
3164
3155
    // Compute constants
3165
 
    const double C0 = x[1][0] + x[2][0];
3166
 
    const double C1 = x[1][1] + x[2][1];
 
3156
    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
 
3157
    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
3167
3158
    
3168
3159
    // Get coordinates and map to the reference (FIAT) element
3169
 
    double X = (J_01*(C1 - 2.0*coordinates[1]) + J_11*(2.0*coordinates[0] - C0)) / detJ;
3170
 
    double Y = (J_00*(2.0*coordinates[1] - C1) + J_10*(C0 - 2.0*coordinates[0])) / detJ;
 
3160
    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
 
3161
    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
3171
3162
    
3172
3163
    // Compute number of derivatives.
3173
3164
    unsigned int num_derivatives = 1;
3204
3195
    }
3205
3196
    
3206
3197
    // Compute inverse of Jacobian
3207
 
    const double Jinv[2][2] = {{K_00, K_01}, {K_10, K_11}};
 
3198
    const double Jinv[2][2] = {{K[0], K[1]}, {K[2], K[3]}};
3208
3199
    
3209
3200
    // Declare transformation matrix
3210
3201
    // Declare pointer to two dimensional array and initialise
3238
3229
    case 0:
3239
3230
      {
3240
3231
        
3241
 
      // Array of basisvalues.
 
3232
      // Array of basisvalues
3242
3233
      double basisvalues[1] = {0.0};
3243
3234
      
3244
 
      // Declare helper variables.
 
3235
      // Declare helper variables
3245
3236
      
3246
 
      // Compute basisvalues.
 
3237
      // Compute basisvalues
3247
3238
      basisvalues[0] = 1.0;
3248
3239
      
3249
 
      // Table(s) of coefficients.
 
3240
      // Table(s) of coefficients
3250
3241
      static const double coefficients0[1] = \
3251
3242
      {1.0};
3252
3243
      
3370
3361
    case 1:
3371
3362
      {
3372
3363
        
3373
 
      // Array of basisvalues.
 
3364
      // Array of basisvalues
3374
3365
      double basisvalues[1] = {0.0};
3375
3366
      
3376
 
      // Declare helper variables.
 
3367
      // Declare helper variables
3377
3368
      
3378
 
      // Compute basisvalues.
 
3369
      // Compute basisvalues
3379
3370
      basisvalues[0] = 1.0;
3380
3371
      
3381
 
      // Table(s) of coefficients.
 
3372
      // Table(s) of coefficients
3382
3373
      static const double coefficients0[1] = \
3383
3374
      {1.0};
3384
3375
      
3502
3493
    case 2:
3503
3494
      {
3504
3495
        
3505
 
      // Array of basisvalues.
 
3496
      // Array of basisvalues
3506
3497
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
3507
3498
      
3508
 
      // Declare helper variables.
 
3499
      // Declare helper variables
3509
3500
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
3510
3501
      double tmp1 = (1.0 - Y)/2.0;
3511
3502
      double tmp2 = tmp1*tmp1;
3512
3503
      
3513
 
      // Compute basisvalues.
 
3504
      // Compute basisvalues
3514
3505
      basisvalues[0] = 1.0;
3515
3506
      basisvalues[1] = tmp0;
3516
3507
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
3524
3515
      basisvalues[4] *= std::sqrt(4.5);
3525
3516
      basisvalues[3] *= std::sqrt(7.5);
3526
3517
      
3527
 
      // Table(s) of coefficients.
 
3518
      // Table(s) of coefficients
3528
3519
      static const double coefficients0[6] = \
3529
3520
      {0.0, -0.17320508, -0.1, 0.12171612, 0.094280904, 0.054433105};
3530
3521
      
3668
3659
    case 3:
3669
3660
      {
3670
3661
        
3671
 
      // Array of basisvalues.
 
3662
      // Array of basisvalues
3672
3663
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
3673
3664
      
3674
 
      // Declare helper variables.
 
3665
      // Declare helper variables
3675
3666
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
3676
3667
      double tmp1 = (1.0 - Y)/2.0;
3677
3668
      double tmp2 = tmp1*tmp1;
3678
3669
      
3679
 
      // Compute basisvalues.
 
3670
      // Compute basisvalues
3680
3671
      basisvalues[0] = 1.0;
3681
3672
      basisvalues[1] = tmp0;
3682
3673
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
3690
3681
      basisvalues[4] *= std::sqrt(4.5);
3691
3682
      basisvalues[3] *= std::sqrt(7.5);
3692
3683
      
3693
 
      // Table(s) of coefficients.
 
3684
      // Table(s) of coefficients
3694
3685
      static const double coefficients0[6] = \
3695
3686
      {0.0, 0.17320508, -0.1, 0.12171612, -0.094280904, 0.054433105};
3696
3687
      
3834
3825
    case 4:
3835
3826
      {
3836
3827
        
3837
 
      // Array of basisvalues.
 
3828
      // Array of basisvalues
3838
3829
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
3839
3830
      
3840
 
      // Declare helper variables.
 
3831
      // Declare helper variables
3841
3832
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
3842
3833
      double tmp1 = (1.0 - Y)/2.0;
3843
3834
      double tmp2 = tmp1*tmp1;
3844
3835
      
3845
 
      // Compute basisvalues.
 
3836
      // Compute basisvalues
3846
3837
      basisvalues[0] = 1.0;
3847
3838
      basisvalues[1] = tmp0;
3848
3839
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
3856
3847
      basisvalues[4] *= std::sqrt(4.5);
3857
3848
      basisvalues[3] *= std::sqrt(7.5);
3858
3849
      
3859
 
      // Table(s) of coefficients.
 
3850
      // Table(s) of coefficients
3860
3851
      static const double coefficients0[6] = \
3861
3852
      {0.0, 0.0, 0.2, 0.0, 0.0, 0.16329932};
3862
3853
      
4000
3991
    case 5:
4001
3992
      {
4002
3993
        
4003
 
      // Array of basisvalues.
 
3994
      // Array of basisvalues
4004
3995
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
4005
3996
      
4006
 
      // Declare helper variables.
 
3997
      // Declare helper variables
4007
3998
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
4008
3999
      double tmp1 = (1.0 - Y)/2.0;
4009
4000
      double tmp2 = tmp1*tmp1;
4010
4001
      
4011
 
      // Compute basisvalues.
 
4002
      // Compute basisvalues
4012
4003
      basisvalues[0] = 1.0;
4013
4004
      basisvalues[1] = tmp0;
4014
4005
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
4022
4013
      basisvalues[4] *= std::sqrt(4.5);
4023
4014
      basisvalues[3] *= std::sqrt(7.5);
4024
4015
      
4025
 
      // Table(s) of coefficients.
 
4016
      // Table(s) of coefficients
4026
4017
      static const double coefficients0[6] = \
4027
4018
      {0.47140452, 0.23094011, 0.13333333, 0.0, 0.18856181, -0.16329932};
4028
4019
      
4166
4157
    case 6:
4167
4158
      {
4168
4159
        
4169
 
      // Array of basisvalues.
 
4160
      // Array of basisvalues
4170
4161
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
4171
4162
      
4172
 
      // Declare helper variables.
 
4163
      // Declare helper variables
4173
4164
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
4174
4165
      double tmp1 = (1.0 - Y)/2.0;
4175
4166
      double tmp2 = tmp1*tmp1;
4176
4167
      
4177
 
      // Compute basisvalues.
 
4168
      // Compute basisvalues
4178
4169
      basisvalues[0] = 1.0;
4179
4170
      basisvalues[1] = tmp0;
4180
4171
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
4188
4179
      basisvalues[4] *= std::sqrt(4.5);
4189
4180
      basisvalues[3] *= std::sqrt(7.5);
4190
4181
      
4191
 
      // Table(s) of coefficients.
 
4182
      // Table(s) of coefficients
4192
4183
      static const double coefficients0[6] = \
4193
4184
      {0.47140452, -0.23094011, 0.13333333, 0.0, -0.18856181, -0.16329932};
4194
4185
      
4332
4323
    case 7:
4333
4324
      {
4334
4325
        
4335
 
      // Array of basisvalues.
 
4326
      // Array of basisvalues
4336
4327
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
4337
4328
      
4338
 
      // Declare helper variables.
 
4329
      // Declare helper variables
4339
4330
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
4340
4331
      double tmp1 = (1.0 - Y)/2.0;
4341
4332
      double tmp2 = tmp1*tmp1;
4342
4333
      
4343
 
      // Compute basisvalues.
 
4334
      // Compute basisvalues
4344
4335
      basisvalues[0] = 1.0;
4345
4336
      basisvalues[1] = tmp0;
4346
4337
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
4354
4345
      basisvalues[4] *= std::sqrt(4.5);
4355
4346
      basisvalues[3] *= std::sqrt(7.5);
4356
4347
      
4357
 
      // Table(s) of coefficients.
 
4348
      // Table(s) of coefficients
4358
4349
      static const double coefficients0[6] = \
4359
4350
      {0.47140452, 0.0, -0.26666667, -0.24343225, 0.0, 0.054433105};
4360
4351
      
4499
4490
    
4500
4491
  }
4501
4492
 
4502
 
  /// Evaluate order n derivatives of all basis functions at given point in cell
4503
 
  virtual void evaluate_basis_derivatives_all(unsigned int n,
 
4493
  /// Evaluate order n derivatives of all basis functions at given point x in cell
 
4494
  virtual void evaluate_basis_derivatives_all(std::size_t n,
4504
4495
                                              double* values,
4505
 
                                              const double* coordinates,
4506
 
                                              const ufc::cell& c) const
 
4496
                                              const double* x,
 
4497
                                              const double* vertex_coordinates,
 
4498
                                              int cell_orientation) const
4507
4499
  {
4508
4500
    // Compute number of derivatives.
4509
4501
    unsigned int num_derivatives = 1;
4522
4514
    // Loop dofs and call evaluate_basis_derivatives.
4523
4515
    for (unsigned int r = 0; r < 8; r++)
4524
4516
    {
4525
 
      evaluate_basis_derivatives(r, n, dof_values, coordinates, c);
 
4517
      evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
4526
4518
      for (unsigned int s = 0; s < 3*num_derivatives; s++)
4527
4519
      {
4528
4520
        values[r*3*num_derivatives + s] = dof_values[s];
4534
4526
  }
4535
4527
 
4536
4528
  /// Evaluate linear functional for dof i on the function f
4537
 
  virtual double evaluate_dof(unsigned int i,
 
4529
  virtual double evaluate_dof(std::size_t i,
4538
4530
                              const ufc::function& f,
 
4531
                              const double* vertex_coordinates,
 
4532
                              int cell_orientation,
4539
4533
                              const ufc::cell& c) const
4540
4534
  {
4541
 
    // Declare variables for result of evaluation.
 
4535
    // Declare variables for result of evaluation
4542
4536
    double vals[3];
4543
4537
    
4544
 
    // Declare variable for physical coordinates.
 
4538
    // Declare variable for physical coordinates
4545
4539
    double y[2];
4546
 
    const double * const * x = c.coordinates;
4547
4540
    switch (i)
4548
4541
    {
4549
4542
    case 0:
4550
4543
      {
4551
 
        y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
4552
 
      y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
4544
        y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
4545
      y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
4553
4546
      f.evaluate(vals, y, c);
4554
4547
      return vals[0];
4555
4548
        break;
4556
4549
      }
4557
4550
    case 1:
4558
4551
      {
4559
 
        y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
4560
 
      y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
4552
        y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
4553
      y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
4561
4554
      f.evaluate(vals, y, c);
4562
4555
      return vals[1];
4563
4556
        break;
4564
4557
      }
4565
4558
    case 2:
4566
4559
      {
4567
 
        y[0] = x[0][0];
4568
 
      y[1] = x[0][1];
 
4560
        y[0] = vertex_coordinates[0];
 
4561
      y[1] = vertex_coordinates[1];
4569
4562
      f.evaluate(vals, y, c);
4570
4563
      return vals[2];
4571
4564
        break;
4572
4565
      }
4573
4566
    case 3:
4574
4567
      {
4575
 
        y[0] = x[1][0];
4576
 
      y[1] = x[1][1];
 
4568
        y[0] = vertex_coordinates[2];
 
4569
      y[1] = vertex_coordinates[3];
4577
4570
      f.evaluate(vals, y, c);
4578
4571
      return vals[2];
4579
4572
        break;
4580
4573
      }
4581
4574
    case 4:
4582
4575
      {
4583
 
        y[0] = x[2][0];
4584
 
      y[1] = x[2][1];
 
4576
        y[0] = vertex_coordinates[4];
 
4577
      y[1] = vertex_coordinates[5];
4585
4578
      f.evaluate(vals, y, c);
4586
4579
      return vals[2];
4587
4580
        break;
4588
4581
      }
4589
4582
    case 5:
4590
4583
      {
4591
 
        y[0] = 0.5*x[1][0] + 0.5*x[2][0];
4592
 
      y[1] = 0.5*x[1][1] + 0.5*x[2][1];
 
4584
        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
4585
      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
4593
4586
      f.evaluate(vals, y, c);
4594
4587
      return vals[2];
4595
4588
        break;
4596
4589
      }
4597
4590
    case 6:
4598
4591
      {
4599
 
        y[0] = 0.5*x[0][0] + 0.5*x[2][0];
4600
 
      y[1] = 0.5*x[0][1] + 0.5*x[2][1];
 
4592
        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
 
4593
      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
4601
4594
      f.evaluate(vals, y, c);
4602
4595
      return vals[2];
4603
4596
        break;
4604
4597
      }
4605
4598
    case 7:
4606
4599
      {
4607
 
        y[0] = 0.5*x[0][0] + 0.5*x[1][0];
4608
 
      y[1] = 0.5*x[0][1] + 0.5*x[1][1];
 
4600
        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
 
4601
      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
4609
4602
      f.evaluate(vals, y, c);
4610
4603
      return vals[2];
4611
4604
        break;
4618
4611
  /// Evaluate linear functionals for all dofs on the function f
4619
4612
  virtual void evaluate_dofs(double* values,
4620
4613
                             const ufc::function& f,
 
4614
                             const double* vertex_coordinates,
 
4615
                             int cell_orientation,
4621
4616
                             const ufc::cell& c) const
4622
4617
  {
4623
 
    // Declare variables for result of evaluation.
 
4618
    // Declare variables for result of evaluation
4624
4619
    double vals[3];
4625
4620
    
4626
 
    // Declare variable for physical coordinates.
 
4621
    // Declare variable for physical coordinates
4627
4622
    double y[2];
4628
 
    const double * const * x = c.coordinates;
4629
 
    y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
4630
 
    y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
4623
    y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
4624
    y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
4631
4625
    f.evaluate(vals, y, c);
4632
4626
    values[0] = vals[0];
4633
 
    y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
4634
 
    y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
4627
    y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
4628
    y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
4635
4629
    f.evaluate(vals, y, c);
4636
4630
    values[1] = vals[1];
4637
 
    y[0] = x[0][0];
4638
 
    y[1] = x[0][1];
 
4631
    y[0] = vertex_coordinates[0];
 
4632
    y[1] = vertex_coordinates[1];
4639
4633
    f.evaluate(vals, y, c);
4640
4634
    values[2] = vals[2];
4641
 
    y[0] = x[1][0];
4642
 
    y[1] = x[1][1];
 
4635
    y[0] = vertex_coordinates[2];
 
4636
    y[1] = vertex_coordinates[3];
4643
4637
    f.evaluate(vals, y, c);
4644
4638
    values[3] = vals[2];
4645
 
    y[0] = x[2][0];
4646
 
    y[1] = x[2][1];
 
4639
    y[0] = vertex_coordinates[4];
 
4640
    y[1] = vertex_coordinates[5];
4647
4641
    f.evaluate(vals, y, c);
4648
4642
    values[4] = vals[2];
4649
 
    y[0] = 0.5*x[1][0] + 0.5*x[2][0];
4650
 
    y[1] = 0.5*x[1][1] + 0.5*x[2][1];
 
4643
    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
4644
    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
4651
4645
    f.evaluate(vals, y, c);
4652
4646
    values[5] = vals[2];
4653
 
    y[0] = 0.5*x[0][0] + 0.5*x[2][0];
4654
 
    y[1] = 0.5*x[0][1] + 0.5*x[2][1];
 
4647
    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
 
4648
    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
4655
4649
    f.evaluate(vals, y, c);
4656
4650
    values[6] = vals[2];
4657
 
    y[0] = 0.5*x[0][0] + 0.5*x[1][0];
4658
 
    y[1] = 0.5*x[0][1] + 0.5*x[1][1];
 
4651
    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
 
4652
    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
4659
4653
    f.evaluate(vals, y, c);
4660
4654
    values[7] = vals[2];
4661
4655
  }
4663
4657
  /// Interpolate vertex values from dof values
4664
4658
  virtual void interpolate_vertex_values(double* vertex_values,
4665
4659
                                         const double* dof_values,
 
4660
                                         const double* vertex_coordinates,
 
4661
                                         int cell_orientation,
4666
4662
                                         const ufc::cell& c) const
4667
4663
  {
4668
4664
    // Evaluate function and change variables
4684
4680
                                       const double* xhat,
4685
4681
                                       const ufc::cell& c) const
4686
4682
  {
4687
 
    std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented (introduced in UFC 2.0)." << std::endl;
 
4683
    std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented." << std::endl;
4688
4684
  }
4689
4685
 
4690
4686
  /// Map from coordinate x in cell to coordinate xhat in reference cell
4692
4688
                                     const double* x,
4693
4689
                                     const ufc::cell& c) const
4694
4690
  {
4695
 
    std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented (introduced in UFC 2.0)." << std::endl;
 
4691
    std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented." << std::endl;
4696
4692
  }
4697
4693
 
4698
4694
  /// Return the number of sub elements (for a mixed element)
4699
 
  virtual unsigned int num_sub_elements() const
 
4695
  virtual std::size_t num_sub_elements() const
4700
4696
  {
4701
4697
    return 2;
4702
4698
  }
4703
4699
 
4704
4700
  /// Create a new finite element for sub element i (for a mixed element)
4705
 
  virtual ufc::finite_element* create_sub_element(unsigned int i) const
 
4701
  virtual ufc::finite_element* create_sub_element(std::size_t i) const
4706
4702
  {
4707
4703
    switch (i)
4708
4704
    {
4750
4746
  /// Return a string identifying the finite element
4751
4747
  virtual const char* signature() const
4752
4748
  {
4753
 
    return "FiniteElement('Raviart-Thomas', Cell('triangle', Space(2)), 3, None)";
 
4749
    return "FiniteElement('Raviart-Thomas', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 3, None)";
4754
4750
  }
4755
4751
 
4756
4752
  /// Return the cell shape
4760
4756
  }
4761
4757
 
4762
4758
  /// Return the topological dimension of the cell shape
4763
 
  virtual unsigned int topological_dimension() const
 
4759
  virtual std::size_t topological_dimension() const
4764
4760
  {
4765
4761
    return 2;
4766
4762
  }
4767
4763
 
4768
4764
  /// Return the geometric dimension of the cell shape
4769
 
  virtual unsigned int geometric_dimension() const
 
4765
  virtual std::size_t geometric_dimension() const
4770
4766
  {
4771
4767
    return 2;
4772
4768
  }
4773
4769
 
4774
4770
  /// Return the dimension of the finite element function space
4775
 
  virtual unsigned int space_dimension() const
 
4771
  virtual std::size_t space_dimension() const
4776
4772
  {
4777
4773
    return 15;
4778
4774
  }
4779
4775
 
4780
4776
  /// Return the rank of the value space
4781
 
  virtual unsigned int value_rank() const
 
4777
  virtual std::size_t value_rank() const
4782
4778
  {
4783
4779
    return 1;
4784
4780
  }
4785
4781
 
4786
4782
  /// Return the dimension of the value space for axis i
4787
 
  virtual unsigned int value_dimension(unsigned int i) const
 
4783
  virtual std::size_t value_dimension(std::size_t i) const
4788
4784
  {
4789
4785
    switch (i)
4790
4786
    {
4798
4794
    return 0;
4799
4795
  }
4800
4796
 
4801
 
  /// Evaluate basis function i at given point in cell
4802
 
  virtual void evaluate_basis(unsigned int i,
 
4797
  /// Evaluate basis function i at given point x in cell
 
4798
  virtual void evaluate_basis(std::size_t i,
4803
4799
                              double* values,
4804
 
                              const double* coordinates,
4805
 
                              const ufc::cell& c) const
 
4800
                              const double* x,
 
4801
                              const double* vertex_coordinates,
 
4802
                              int cell_orientation) const
4806
4803
  {
4807
 
    // Extract vertex coordinates
4808
 
    const double * const * x = c.coordinates;
4809
 
    
4810
 
    // Compute Jacobian of affine map from reference cell
4811
 
    const double J_00 = x[1][0] - x[0][0];
4812
 
    const double J_01 = x[2][0] - x[0][0];
4813
 
    const double J_10 = x[1][1] - x[0][1];
4814
 
    const double J_11 = x[2][1] - x[0][1];
4815
 
    
4816
 
    // Compute determinant of Jacobian
4817
 
    double detJ = J_00*J_11 - J_01*J_10;
4818
 
    
4819
 
    // Compute inverse of Jacobian
 
4804
    // Compute Jacobian
 
4805
    double J[4];
 
4806
    compute_jacobian_triangle_2d(J, vertex_coordinates);
 
4807
    
 
4808
    // Compute Jacobian inverse and determinant
 
4809
    double K[4];
 
4810
    double detJ;
 
4811
    compute_jacobian_inverse_triangle_2d(K, detJ, J);
 
4812
    
 
4813
    
4820
4814
    
4821
4815
    // Compute constants
4822
 
    const double C0 = x[1][0] + x[2][0];
4823
 
    const double C1 = x[1][1] + x[2][1];
 
4816
    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
 
4817
    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
4824
4818
    
4825
4819
    // Get coordinates and map to the reference (FIAT) element
4826
 
    double X = (J_01*(C1 - 2.0*coordinates[1]) + J_11*(2.0*coordinates[0] - C0)) / detJ;
4827
 
    double Y = (J_00*(2.0*coordinates[1] - C1) + J_10*(C0 - 2.0*coordinates[0])) / detJ;
 
4820
    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
 
4821
    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
4828
4822
    
4829
 
    // Reset values.
 
4823
    // Reset values
4830
4824
    values[0] = 0.0;
4831
4825
    values[1] = 0.0;
4832
4826
    switch (i)
4834
4828
    case 0:
4835
4829
      {
4836
4830
        
4837
 
      // Array of basisvalues.
 
4831
      // Array of basisvalues
4838
4832
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
4839
4833
      
4840
 
      // Declare helper variables.
 
4834
      // Declare helper variables
4841
4835
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
4842
4836
      double tmp1 = (1.0 - Y)/2.0;
4843
4837
      double tmp2 = tmp1*tmp1;
4844
4838
      
4845
 
      // Compute basisvalues.
 
4839
      // Compute basisvalues
4846
4840
      basisvalues[0] = 1.0;
4847
4841
      basisvalues[1] = tmp0;
4848
4842
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
4864
4858
      basisvalues[7] *= std::sqrt(10.0);
4865
4859
      basisvalues[6] *= std::sqrt(14.0);
4866
4860
      
4867
 
      // Table(s) of coefficients.
 
4861
      // Table(s) of coefficients
4868
4862
      static const double coefficients0[10] = \
4869
4863
      {0.18856181, 0.28867513, -0.16666667, 0.26082027, -0.20203051, 0.11664237, 0.1069045, -0.09035079, 0.069985421, -0.040406102};
4870
4864
      
4871
4865
      static const double coefficients1[10] = \
4872
4866
      {0.14142136, -0.038490018, 0.13333333, 0.069552071, -0.12121831, 0.089425816, 0.0, 0.06023386, -0.077761579, 0.053874802};
4873
4867
      
4874
 
      // Compute value(s).
 
4868
      // Compute value(s)
4875
4869
      for (unsigned int r = 0; r < 10; r++)
4876
4870
      {
4877
4871
        values[0] += coefficients0[r]*basisvalues[r];
4878
4872
        values[1] += coefficients1[r]*basisvalues[r];
4879
4873
      }// end loop over 'r'
4880
4874
      
4881
 
      // Using contravariant Piola transform to map values back to the physical element.
 
4875
      // Using contravariant Piola transform to map values back to the physical element
4882
4876
      const double tmp_ref0 = values[0];
4883
4877
      const double tmp_ref1 = values[1];
4884
 
      values[0] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
4885
 
      values[1] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
4878
      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
4879
      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
4886
4880
        break;
4887
4881
      }
4888
4882
    case 1:
4889
4883
      {
4890
4884
        
4891
 
      // Array of basisvalues.
 
4885
      // Array of basisvalues
4892
4886
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
4893
4887
      
4894
 
      // Declare helper variables.
 
4888
      // Declare helper variables
4895
4889
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
4896
4890
      double tmp1 = (1.0 - Y)/2.0;
4897
4891
      double tmp2 = tmp1*tmp1;
4898
4892
      
4899
 
      // Compute basisvalues.
 
4893
      // Compute basisvalues
4900
4894
      basisvalues[0] = 1.0;
4901
4895
      basisvalues[1] = tmp0;
4902
4896
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
4918
4912
      basisvalues[7] *= std::sqrt(10.0);
4919
4913
      basisvalues[6] *= std::sqrt(14.0);
4920
4914
      
4921
 
      // Table(s) of coefficients.
 
4915
      // Table(s) of coefficients
4922
4916
      static const double coefficients0[10] = \
4923
4917
      {-0.18856181, -0.25018512, 0.23333333, -0.10432811, 0.32324881, -0.25661321, 0.0, 0.12046772, -0.15552316, 0.1077496};
4924
4918
      
4925
4919
      static const double coefficients1[10] = \
4926
4920
      {-0.18856181, 0.076980036, -0.33333333, 0.0, 0.24243661, -0.34992711, 0.0, 0.0, 0.15552316, -0.16162441};
4927
4921
      
4928
 
      // Compute value(s).
 
4922
      // Compute value(s)
4929
4923
      for (unsigned int r = 0; r < 10; r++)
4930
4924
      {
4931
4925
        values[0] += coefficients0[r]*basisvalues[r];
4932
4926
        values[1] += coefficients1[r]*basisvalues[r];
4933
4927
      }// end loop over 'r'
4934
4928
      
4935
 
      // Using contravariant Piola transform to map values back to the physical element.
 
4929
      // Using contravariant Piola transform to map values back to the physical element
4936
4930
      const double tmp_ref0 = values[0];
4937
4931
      const double tmp_ref1 = values[1];
4938
 
      values[0] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
4939
 
      values[1] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
4932
      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
4933
      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
4940
4934
        break;
4941
4935
      }
4942
4936
    case 2:
4943
4937
      {
4944
4938
        
4945
 
      // Array of basisvalues.
 
4939
      // Array of basisvalues
4946
4940
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
4947
4941
      
4948
 
      // Declare helper variables.
 
4942
      // Declare helper variables
4949
4943
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
4950
4944
      double tmp1 = (1.0 - Y)/2.0;
4951
4945
      double tmp2 = tmp1*tmp1;
4952
4946
      
4953
 
      // Compute basisvalues.
 
4947
      // Compute basisvalues
4954
4948
      basisvalues[0] = 1.0;
4955
4949
      basisvalues[1] = tmp0;
4956
4950
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
4972
4966
      basisvalues[7] *= std::sqrt(10.0);
4973
4967
      basisvalues[6] *= std::sqrt(14.0);
4974
4968
      
4975
 
      // Table(s) of coefficients.
 
4969
      // Table(s) of coefficients
4976
4970
      static const double coefficients0[10] = \
4977
4971
      {0.14142136, 0.096225045, -0.1, 0.0, -0.067343503, 0.15163508, 0.0, 0.0, 0.077761579, -0.080812204};
4978
4972
      
4979
4973
      static const double coefficients1[10] = \
4980
4974
      {0.18856181, 0.0, 0.33333333, 0.0, 0.0, 0.34992711, 0.0, 0.0, 0.0, 0.16162441};
4981
4975
      
4982
 
      // Compute value(s).
 
4976
      // Compute value(s)
4983
4977
      for (unsigned int r = 0; r < 10; r++)
4984
4978
      {
4985
4979
        values[0] += coefficients0[r]*basisvalues[r];
4986
4980
        values[1] += coefficients1[r]*basisvalues[r];
4987
4981
      }// end loop over 'r'
4988
4982
      
4989
 
      // Using contravariant Piola transform to map values back to the physical element.
 
4983
      // Using contravariant Piola transform to map values back to the physical element
4990
4984
      const double tmp_ref0 = values[0];
4991
4985
      const double tmp_ref1 = values[1];
4992
 
      values[0] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
4993
 
      values[1] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
4986
      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
4987
      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
4994
4988
        break;
4995
4989
      }
4996
4990
    case 3:
4997
4991
      {
4998
4992
        
4999
 
      // Array of basisvalues.
 
4993
      // Array of basisvalues
5000
4994
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
5001
4995
      
5002
 
      // Declare helper variables.
 
4996
      // Declare helper variables
5003
4997
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
5004
4998
      double tmp1 = (1.0 - Y)/2.0;
5005
4999
      double tmp2 = tmp1*tmp1;
5006
5000
      
5007
 
      // Compute basisvalues.
 
5001
      // Compute basisvalues
5008
5002
      basisvalues[0] = 1.0;
5009
5003
      basisvalues[1] = tmp0;
5010
5004
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
5026
5020
      basisvalues[7] *= std::sqrt(10.0);
5027
5021
      basisvalues[6] *= std::sqrt(14.0);
5028
5022
      
5029
 
      // Table(s) of coefficients.
 
5023
      // Table(s) of coefficients
5030
5024
      static const double coefficients0[10] = \
5031
5025
      {0.32998316, -0.25018512, -0.033333333, 0.33037234, 0.32324881, 0.20606818, -0.1069045, -0.03011693, 0.0077761579, 0.013468701};
5032
5026
      
5033
5027
      static const double coefficients1[10] = \
5034
5028
      {-0.14142136, -0.038490018, -0.13333333, -0.069552071, -0.12121831, -0.089425816, 0.0, -0.06023386, -0.077761579, -0.053874802};
5035
5029
      
5036
 
      // Compute value(s).
 
5030
      // Compute value(s)
5037
5031
      for (unsigned int r = 0; r < 10; r++)
5038
5032
      {
5039
5033
        values[0] += coefficients0[r]*basisvalues[r];
5040
5034
        values[1] += coefficients1[r]*basisvalues[r];
5041
5035
      }// end loop over 'r'
5042
5036
      
5043
 
      // Using contravariant Piola transform to map values back to the physical element.
 
5037
      // Using contravariant Piola transform to map values back to the physical element
5044
5038
      const double tmp_ref0 = values[0];
5045
5039
      const double tmp_ref1 = values[1];
5046
 
      values[0] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
5047
 
      values[1] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
5040
      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
5041
      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
5048
5042
        break;
5049
5043
      }
5050
5044
    case 4:
5051
5045
      {
5052
5046
        
5053
 
      // Array of basisvalues.
 
5047
      // Array of basisvalues
5054
5048
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
5055
5049
      
5056
 
      // Declare helper variables.
 
5050
      // Declare helper variables
5057
5051
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
5058
5052
      double tmp1 = (1.0 - Y)/2.0;
5059
5053
      double tmp2 = tmp1*tmp1;
5060
5054
      
5061
 
      // Compute basisvalues.
 
5055
      // Compute basisvalues
5062
5056
      basisvalues[0] = 1.0;
5063
5057
      basisvalues[1] = tmp0;
5064
5058
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
5080
5074
      basisvalues[7] *= std::sqrt(10.0);
5081
5075
      basisvalues[6] *= std::sqrt(14.0);
5082
5076
      
5083
 
      // Table(s) of coefficients.
 
5077
      // Table(s) of coefficients
5084
5078
      static const double coefficients0[10] = \
5085
5079
      {-0.37712362, 0.17320508, -0.1, -0.10432811, -0.56568542, -0.60654032, 0.0, 0.12046772, 0.0, -0.053874802};
5086
5080
      
5087
5081
      static const double coefficients1[10] = \
5088
5082
      {0.18856181, 0.076980036, 0.33333333, 0.0, 0.24243661, 0.34992711, 0.0, 0.0, 0.15552316, 0.16162441};
5089
5083
      
5090
 
      // Compute value(s).
 
5084
      // Compute value(s)
5091
5085
      for (unsigned int r = 0; r < 10; r++)
5092
5086
      {
5093
5087
        values[0] += coefficients0[r]*basisvalues[r];
5094
5088
        values[1] += coefficients1[r]*basisvalues[r];
5095
5089
      }// end loop over 'r'
5096
5090
      
5097
 
      // Using contravariant Piola transform to map values back to the physical element.
 
5091
      // Using contravariant Piola transform to map values back to the physical element
5098
5092
      const double tmp_ref0 = values[0];
5099
5093
      const double tmp_ref1 = values[1];
5100
 
      values[0] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
5101
 
      values[1] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
5094
      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
5095
      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
5102
5096
        break;
5103
5097
      }
5104
5098
    case 5:
5105
5099
      {
5106
5100
        
5107
 
      // Array of basisvalues.
 
5101
      // Array of basisvalues
5108
5102
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
5109
5103
      
5110
 
      // Declare helper variables.
 
5104
      // Declare helper variables
5111
5105
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
5112
5106
      double tmp1 = (1.0 - Y)/2.0;
5113
5107
      double tmp2 = tmp1*tmp1;
5114
5108
      
5115
 
      // Compute basisvalues.
 
5109
      // Compute basisvalues
5116
5110
      basisvalues[0] = 1.0;
5117
5111
      basisvalues[1] = tmp0;
5118
5112
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
5134
5128
      basisvalues[7] *= std::sqrt(10.0);
5135
5129
      basisvalues[6] *= std::sqrt(14.0);
5136
5130
      
5137
 
      // Table(s) of coefficients.
 
5131
      // Table(s) of coefficients
5138
5132
      static const double coefficients0[10] = \
5139
5133
      {0.32998316, -0.096225045, 0.23333333, 0.0, 0.067343503, 0.50156219, 0.0, 0.0, -0.077761579, 0.080812204};
5140
5134
      
5141
5135
      static const double coefficients1[10] = \
5142
5136
      {-0.18856181, 0.0, -0.33333333, 0.0, 0.0, -0.34992711, 0.0, 0.0, 0.0, -0.16162441};
5143
5137
      
5144
 
      // Compute value(s).
 
5138
      // Compute value(s)
5145
5139
      for (unsigned int r = 0; r < 10; r++)
5146
5140
      {
5147
5141
        values[0] += coefficients0[r]*basisvalues[r];
5148
5142
        values[1] += coefficients1[r]*basisvalues[r];
5149
5143
      }// end loop over 'r'
5150
5144
      
5151
 
      // Using contravariant Piola transform to map values back to the physical element.
 
5145
      // Using contravariant Piola transform to map values back to the physical element
5152
5146
      const double tmp_ref0 = values[0];
5153
5147
      const double tmp_ref1 = values[1];
5154
 
      values[0] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
5155
 
      values[1] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
5148
      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
5149
      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
5156
5150
        break;
5157
5151
      }
5158
5152
    case 6:
5159
5153
      {
5160
5154
        
5161
 
      // Array of basisvalues.
 
5155
      // Array of basisvalues
5162
5156
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
5163
5157
      
5164
 
      // Declare helper variables.
 
5158
      // Declare helper variables
5165
5159
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
5166
5160
      double tmp1 = (1.0 - Y)/2.0;
5167
5161
      double tmp2 = tmp1*tmp1;
5168
5162
      
5169
 
      // Compute basisvalues.
 
5163
      // Compute basisvalues
5170
5164
      basisvalues[0] = 1.0;
5171
5165
      basisvalues[1] = tmp0;
5172
5166
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
5188
5182
      basisvalues[7] *= std::sqrt(10.0);
5189
5183
      basisvalues[6] *= std::sqrt(14.0);
5190
5184
      
5191
 
      // Table(s) of coefficients.
 
5185
      // Table(s) of coefficients
5192
5186
      static const double coefficients0[10] = \
5193
5187
      {0.14142136, 0.13471506, -0.033333333, 0.15649216, 0.053874802, 0.011664237, 0.1069045, 0.03011693, -0.0077761579, -0.013468701};
5194
5188
      
5195
5189
      static const double coefficients1[10] = \
5196
5190
      {-0.32998316, 0.15396007, 0.2, -0.41731242, -0.25590531, -0.12830661, 0.0, 0.06023386, 0.077761579, 0.053874802};
5197
5191
      
5198
 
      // Compute value(s).
 
5192
      // Compute value(s)
5199
5193
      for (unsigned int r = 0; r < 10; r++)
5200
5194
      {
5201
5195
        values[0] += coefficients0[r]*basisvalues[r];
5202
5196
        values[1] += coefficients1[r]*basisvalues[r];
5203
5197
      }// end loop over 'r'
5204
5198
      
5205
 
      // Using contravariant Piola transform to map values back to the physical element.
 
5199
      // Using contravariant Piola transform to map values back to the physical element
5206
5200
      const double tmp_ref0 = values[0];
5207
5201
      const double tmp_ref1 = values[1];
5208
 
      values[0] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
5209
 
      values[1] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
5202
      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
5203
      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
5210
5204
        break;
5211
5205
      }
5212
5206
    case 7:
5213
5207
      {
5214
5208
        
5215
 
      // Array of basisvalues.
 
5209
      // Array of basisvalues
5216
5210
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
5217
5211
      
5218
 
      // Declare helper variables.
 
5212
      // Declare helper variables
5219
5213
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
5220
5214
      double tmp1 = (1.0 - Y)/2.0;
5221
5215
      double tmp2 = tmp1*tmp1;
5222
5216
      
5223
 
      // Compute basisvalues.
 
5217
      // Compute basisvalues
5224
5218
      basisvalues[0] = 1.0;
5225
5219
      basisvalues[1] = tmp0;
5226
5220
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
5242
5236
      basisvalues[7] *= std::sqrt(10.0);
5243
5237
      basisvalues[6] *= std::sqrt(14.0);
5244
5238
      
5245
 
      // Table(s) of coefficients.
 
5239
      // Table(s) of coefficients
5246
5240
      static const double coefficients0[10] = \
5247
5241
      {-0.18856181, -0.32716515, 0.1, -0.41731242, 0.080812204, 0.023328474, -0.21380899, 0.06023386, 0.015552316, -0.026937401};
5248
5242
      
5249
5243
      static const double coefficients1[10] = \
5250
5244
      {0.37712362, 0.0, -0.2, 0.83462485, 0.0, -0.046656947, 0.0, -0.12046772, 0.0, 0.053874802};
5251
5245
      
5252
 
      // Compute value(s).
 
5246
      // Compute value(s)
5253
5247
      for (unsigned int r = 0; r < 10; r++)
5254
5248
      {
5255
5249
        values[0] += coefficients0[r]*basisvalues[r];
5256
5250
        values[1] += coefficients1[r]*basisvalues[r];
5257
5251
      }// end loop over 'r'
5258
5252
      
5259
 
      // Using contravariant Piola transform to map values back to the physical element.
 
5253
      // Using contravariant Piola transform to map values back to the physical element
5260
5254
      const double tmp_ref0 = values[0];
5261
5255
      const double tmp_ref1 = values[1];
5262
 
      values[0] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
5263
 
      values[1] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
5256
      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
5257
      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
5264
5258
        break;
5265
5259
      }
5266
5260
    case 8:
5267
5261
      {
5268
5262
        
5269
 
      // Array of basisvalues.
 
5263
      // Array of basisvalues
5270
5264
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
5271
5265
      
5272
 
      // Declare helper variables.
 
5266
      // Declare helper variables
5273
5267
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
5274
5268
      double tmp1 = (1.0 - Y)/2.0;
5275
5269
      double tmp2 = tmp1*tmp1;
5276
5270
      
5277
 
      // Compute basisvalues.
 
5271
      // Compute basisvalues
5278
5272
      basisvalues[0] = 1.0;
5279
5273
      basisvalues[1] = tmp0;
5280
5274
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
5296
5290
      basisvalues[7] *= std::sqrt(10.0);
5297
5291
      basisvalues[6] *= std::sqrt(14.0);
5298
5292
      
5299
 
      // Table(s) of coefficients.
 
5293
      // Table(s) of coefficients
5300
5294
      static const double coefficients0[10] = \
5301
5295
      {0.18856181, 0.28867513, -0.16666667, 0.26082027, -0.20203051, 0.11664237, 0.1069045, -0.09035079, 0.069985421, -0.040406102};
5302
5296
      
5303
5297
      static const double coefficients1[10] = \
5304
5298
      {-0.32998316, -0.15396007, 0.2, -0.41731242, 0.25590531, -0.12830661, 0.0, 0.06023386, -0.077761579, 0.053874802};
5305
5299
      
5306
 
      // Compute value(s).
 
5300
      // Compute value(s)
5307
5301
      for (unsigned int r = 0; r < 10; r++)
5308
5302
      {
5309
5303
        values[0] += coefficients0[r]*basisvalues[r];
5310
5304
        values[1] += coefficients1[r]*basisvalues[r];
5311
5305
      }// end loop over 'r'
5312
5306
      
5313
 
      // Using contravariant Piola transform to map values back to the physical element.
 
5307
      // Using contravariant Piola transform to map values back to the physical element
5314
5308
      const double tmp_ref0 = values[0];
5315
5309
      const double tmp_ref1 = values[1];
5316
 
      values[0] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
5317
 
      values[1] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
5310
      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
5311
      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
5318
5312
        break;
5319
5313
      }
5320
5314
    case 9:
5321
5315
      {
5322
5316
        
5323
 
      // Array of basisvalues.
 
5317
      // Array of basisvalues
5324
5318
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
5325
5319
      
5326
 
      // Declare helper variables.
 
5320
      // Declare helper variables
5327
5321
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
5328
5322
      double tmp1 = (1.0 - Y)/2.0;
5329
5323
      double tmp2 = tmp1*tmp1;
5330
5324
      
5331
 
      // Compute basisvalues.
 
5325
      // Compute basisvalues
5332
5326
      basisvalues[0] = 1.0;
5333
5327
      basisvalues[1] = tmp0;
5334
5328
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
5350
5344
      basisvalues[7] *= std::sqrt(10.0);
5351
5345
      basisvalues[6] *= std::sqrt(14.0);
5352
5346
      
5353
 
      // Table(s) of coefficients.
 
5347
      // Table(s) of coefficients
5354
5348
      static const double coefficients0[10] = \
5355
5349
      {0.32998316, -0.69282032, -0.53333333, -0.39992441, -0.026937401, 0.20606818, 0.32071349, -0.03011693, -0.023328474, 0.013468701};
5356
5350
      
5357
5351
      static const double coefficients1[10] = \
5358
5352
      {0.23570226, 0.038490018, 0.066666667, 0.20865621, 0.12121831, -0.081649658, 0.0, 0.18070158, 0.077761579, 0.0};
5359
5353
      
5360
 
      // Compute value(s).
 
5354
      // Compute value(s)
5361
5355
      for (unsigned int r = 0; r < 10; r++)
5362
5356
      {
5363
5357
        values[0] += coefficients0[r]*basisvalues[r];
5364
5358
        values[1] += coefficients1[r]*basisvalues[r];
5365
5359
      }// end loop over 'r'
5366
5360
      
5367
 
      // Using contravariant Piola transform to map values back to the physical element.
 
5361
      // Using contravariant Piola transform to map values back to the physical element
5368
5362
      const double tmp_ref0 = values[0];
5369
5363
      const double tmp_ref1 = values[1];
5370
 
      values[0] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
5371
 
      values[1] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
5364
      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
5365
      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
5372
5366
        break;
5373
5367
      }
5374
5368
    case 10:
5375
5369
      {
5376
5370
        
5377
 
      // Array of basisvalues.
 
5371
      // Array of basisvalues
5378
5372
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
5379
5373
      
5380
 
      // Declare helper variables.
 
5374
      // Declare helper variables
5381
5375
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
5382
5376
      double tmp1 = (1.0 - Y)/2.0;
5383
5377
      double tmp2 = tmp1*tmp1;
5384
5378
      
5385
 
      // Compute basisvalues.
 
5379
      // Compute basisvalues
5386
5380
      basisvalues[0] = 1.0;
5387
5381
      basisvalues[1] = tmp0;
5388
5382
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
5404
5398
      basisvalues[7] *= std::sqrt(10.0);
5405
5399
      basisvalues[6] *= std::sqrt(14.0);
5406
5400
      
5407
 
      // Table(s) of coefficients.
 
5401
      // Table(s) of coefficients
5408
5402
      static const double coefficients0[10] = \
5409
5403
      {0.56568542, 0.65433031, -0.46666667, -0.19126819, -0.094280904, 0.12441853, -0.32071349, 0.15058465, -0.054433105, 0.013468701};
5410
5404
      
5411
5405
      static const double coefficients1[10] = \
5412
5406
      {-0.23570226, 0.038490018, -0.066666667, -0.20865621, 0.12121831, 0.081649658, 0.0, -0.18070158, 0.077761579, 0.0};
5413
5407
      
5414
 
      // Compute value(s).
 
5408
      // Compute value(s)
5415
5409
      for (unsigned int r = 0; r < 10; r++)
5416
5410
      {
5417
5411
        values[0] += coefficients0[r]*basisvalues[r];
5418
5412
        values[1] += coefficients1[r]*basisvalues[r];
5419
5413
      }// end loop over 'r'
5420
5414
      
5421
 
      // Using contravariant Piola transform to map values back to the physical element.
 
5415
      // Using contravariant Piola transform to map values back to the physical element
5422
5416
      const double tmp_ref0 = values[0];
5423
5417
      const double tmp_ref1 = values[1];
5424
 
      values[0] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
5425
 
      values[1] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
5418
      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
5419
      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
5426
5420
        break;
5427
5421
      }
5428
5422
    case 11:
5429
5423
      {
5430
5424
        
5431
 
      // Array of basisvalues.
 
5425
      // Array of basisvalues
5432
5426
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
5433
5427
      
5434
 
      // Declare helper variables.
 
5428
      // Declare helper variables
5435
5429
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
5436
5430
      double tmp1 = (1.0 - Y)/2.0;
5437
5431
      double tmp2 = tmp1*tmp1;
5438
5432
      
5439
 
      // Compute basisvalues.
 
5433
      // Compute basisvalues
5440
5434
      basisvalues[0] = 1.0;
5441
5435
      basisvalues[1] = tmp0;
5442
5436
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
5458
5452
      basisvalues[7] *= std::sqrt(10.0);
5459
5453
      basisvalues[6] *= std::sqrt(14.0);
5460
5454
      
5461
 
      // Table(s) of coefficients.
 
5455
      // Table(s) of coefficients
5462
5456
      static const double coefficients0[10] = \
5463
5457
      {0.094280904, 0.076980036, 0.93333333, 0.20865621, 0.24243661, -0.443241, 0.0, -0.24093544, 0.15552316, -0.053874802};
5464
5458
      
5465
5459
      static const double coefficients1[10] = \
5466
5460
      {0.0, -0.15396007, 0.0, 0.0, -0.48487322, 0.0, 0.0, 0.0, -0.31104632, 0.0};
5467
5461
      
5468
 
      // Compute value(s).
 
5462
      // Compute value(s)
5469
5463
      for (unsigned int r = 0; r < 10; r++)
5470
5464
      {
5471
5465
        values[0] += coefficients0[r]*basisvalues[r];
5472
5466
        values[1] += coefficients1[r]*basisvalues[r];
5473
5467
      }// end loop over 'r'
5474
5468
      
5475
 
      // Using contravariant Piola transform to map values back to the physical element.
 
5469
      // Using contravariant Piola transform to map values back to the physical element
5476
5470
      const double tmp_ref0 = values[0];
5477
5471
      const double tmp_ref1 = values[1];
5478
 
      values[0] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
5479
 
      values[1] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
5472
      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
5473
      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
5480
5474
        break;
5481
5475
      }
5482
5476
    case 12:
5483
5477
      {
5484
5478
        
5485
 
      // Array of basisvalues.
 
5479
      // Array of basisvalues
5486
5480
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
5487
5481
      
5488
 
      // Declare helper variables.
 
5482
      // Declare helper variables
5489
5483
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
5490
5484
      double tmp1 = (1.0 - Y)/2.0;
5491
5485
      double tmp2 = tmp1*tmp1;
5492
5486
      
5493
 
      // Compute basisvalues.
 
5487
      // Compute basisvalues
5494
5488
      basisvalues[0] = 1.0;
5495
5489
      basisvalues[1] = tmp0;
5496
5490
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
5512
5506
      basisvalues[7] *= std::sqrt(10.0);
5513
5507
      basisvalues[6] *= std::sqrt(14.0);
5514
5508
      
5515
 
      // Table(s) of coefficients.
 
5509
      // Table(s) of coefficients
5516
5510
      static const double coefficients0[10] = \
5517
5511
      {0.23570226, 0.076980036, 0.0, 0.052164053, 0.24243661, 0.058321184, 0.1069045, 0.15058465, -0.0077761579, -0.067343503};
5518
5512
      
5519
5513
      static const double coefficients1[10] = \
5520
5514
      {0.32998316, -0.80829038, -0.33333333, 0.069552071, -0.39059232, -0.21384434, 0.0, 0.06023386, 0.23328474, 0.21549921};
5521
5515
      
5522
 
      // Compute value(s).
 
5516
      // Compute value(s)
5523
5517
      for (unsigned int r = 0; r < 10; r++)
5524
5518
      {
5525
5519
        values[0] += coefficients0[r]*basisvalues[r];
5526
5520
        values[1] += coefficients1[r]*basisvalues[r];
5527
5521
      }// end loop over 'r'
5528
5522
      
5529
 
      // Using contravariant Piola transform to map values back to the physical element.
 
5523
      // Using contravariant Piola transform to map values back to the physical element
5530
5524
      const double tmp_ref0 = values[0];
5531
5525
      const double tmp_ref1 = values[1];
5532
 
      values[0] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
5533
 
      values[1] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
5526
      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
5527
      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
5534
5528
        break;
5535
5529
      }
5536
5530
    case 13:
5537
5531
      {
5538
5532
        
5539
 
      // Array of basisvalues.
 
5533
      // Array of basisvalues
5540
5534
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
5541
5535
      
5542
 
      // Declare helper variables.
 
5536
      // Declare helper variables
5543
5537
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
5544
5538
      double tmp1 = (1.0 - Y)/2.0;
5545
5539
      double tmp2 = tmp1*tmp1;
5546
5540
      
5547
 
      // Compute basisvalues.
 
5541
      // Compute basisvalues
5548
5542
      basisvalues[0] = 1.0;
5549
5543
      basisvalues[1] = tmp0;
5550
5544
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
5566
5560
      basisvalues[7] *= std::sqrt(10.0);
5567
5561
      basisvalues[6] *= std::sqrt(14.0);
5568
5562
      
5569
 
      // Table(s) of coefficients.
 
5563
      // Table(s) of coefficients
5570
5564
      static const double coefficients0[10] = \
5571
5565
      {0.0, -0.076980036, -0.13333333, -0.31298432, -0.24243661, 0.27994168, -0.21380899, -0.06023386, 0.17107547, -0.13468701};
5572
5566
      
5573
5567
      static const double coefficients1[10] = \
5574
5568
      {0.094280904, 0.84678039, -0.4, -0.13910414, 0.51181062, -0.13219468, 0.0, -0.12046772, -0.15552316, 0.21549921};
5575
5569
      
5576
 
      // Compute value(s).
 
5570
      // Compute value(s)
5577
5571
      for (unsigned int r = 0; r < 10; r++)
5578
5572
      {
5579
5573
        values[0] += coefficients0[r]*basisvalues[r];
5580
5574
        values[1] += coefficients1[r]*basisvalues[r];
5581
5575
      }// end loop over 'r'
5582
5576
      
5583
 
      // Using contravariant Piola transform to map values back to the physical element.
 
5577
      // Using contravariant Piola transform to map values back to the physical element
5584
5578
      const double tmp_ref0 = values[0];
5585
5579
      const double tmp_ref1 = values[1];
5586
 
      values[0] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
5587
 
      values[1] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
5580
      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
5581
      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
5588
5582
        break;
5589
5583
      }
5590
5584
    case 14:
5591
5585
      {
5592
5586
        
5593
 
      // Array of basisvalues.
 
5587
      // Array of basisvalues
5594
5588
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
5595
5589
      
5596
 
      // Declare helper variables.
 
5590
      // Declare helper variables
5597
5591
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
5598
5592
      double tmp1 = (1.0 - Y)/2.0;
5599
5593
      double tmp2 = tmp1*tmp1;
5600
5594
      
5601
 
      // Compute basisvalues.
 
5595
      // Compute basisvalues
5602
5596
      basisvalues[0] = 1.0;
5603
5597
      basisvalues[1] = tmp0;
5604
5598
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
5620
5614
      basisvalues[7] *= std::sqrt(10.0);
5621
5615
      basisvalues[6] *= std::sqrt(14.0);
5622
5616
      
5623
 
      // Table(s) of coefficients.
 
5617
      // Table(s) of coefficients
5624
5618
      static const double coefficients0[10] = \
5625
5619
      {-0.23570226, -0.038490018, 0.066666667, 0.10432811, -0.12121831, -0.19829203, 0.0, -0.12046772, -0.077761579, 0.13468701};
5626
5620
      
5627
5621
      static const double coefficients1[10] = \
5628
5622
      {0.56568542, -0.076980036, 0.8, 0.0, -0.24243661, -0.046656947, 0.0, 0.0, -0.15552316, -0.32324881};
5629
5623
      
5630
 
      // Compute value(s).
 
5624
      // Compute value(s)
5631
5625
      for (unsigned int r = 0; r < 10; r++)
5632
5626
      {
5633
5627
        values[0] += coefficients0[r]*basisvalues[r];
5634
5628
        values[1] += coefficients1[r]*basisvalues[r];
5635
5629
      }// end loop over 'r'
5636
5630
      
5637
 
      // Using contravariant Piola transform to map values back to the physical element.
 
5631
      // Using contravariant Piola transform to map values back to the physical element
5638
5632
      const double tmp_ref0 = values[0];
5639
5633
      const double tmp_ref1 = values[1];
5640
 
      values[0] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
5641
 
      values[1] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
5634
      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
5635
      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
5642
5636
        break;
5643
5637
      }
5644
5638
    }
5645
5639
    
5646
5640
  }
5647
5641
 
5648
 
  /// Evaluate all basis functions at given point in cell
 
5642
  /// Evaluate all basis functions at given point x in cell
5649
5643
  virtual void evaluate_basis_all(double* values,
5650
 
                                  const double* coordinates,
5651
 
                                  const ufc::cell& c) const
 
5644
                                  const double* x,
 
5645
                                  const double* vertex_coordinates,
 
5646
                                  int cell_orientation) const
5652
5647
  {
5653
5648
    // Helper variable to hold values of a single dof.
5654
5649
    double dof_values[2] = {0.0, 0.0};
5655
5650
    
5656
 
    // Loop dofs and call evaluate_basis.
 
5651
    // Loop dofs and call evaluate_basis
5657
5652
    for (unsigned int r = 0; r < 15; r++)
5658
5653
    {
5659
 
      evaluate_basis(r, dof_values, coordinates, c);
 
5654
      evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
5660
5655
      for (unsigned int s = 0; s < 2; s++)
5661
5656
      {
5662
5657
        values[r*2 + s] = dof_values[s];
5664
5659
    }// end loop over 'r'
5665
5660
  }
5666
5661
 
5667
 
  /// Evaluate order n derivatives of basis function i at given point in cell
5668
 
  virtual void evaluate_basis_derivatives(unsigned int i,
5669
 
                                          unsigned int n,
 
5662
  /// Evaluate order n derivatives of basis function i at given point x in cell
 
5663
  virtual void evaluate_basis_derivatives(std::size_t i,
 
5664
                                          std::size_t n,
5670
5665
                                          double* values,
5671
 
                                          const double* coordinates,
5672
 
                                          const ufc::cell& c) const
 
5666
                                          const double* x,
 
5667
                                          const double* vertex_coordinates,
 
5668
                                          int cell_orientation) const
5673
5669
  {
5674
 
    // Extract vertex coordinates
5675
 
    const double * const * x = c.coordinates;
5676
 
    
5677
 
    // Compute Jacobian of affine map from reference cell
5678
 
    const double J_00 = x[1][0] - x[0][0];
5679
 
    const double J_01 = x[2][0] - x[0][0];
5680
 
    const double J_10 = x[1][1] - x[0][1];
5681
 
    const double J_11 = x[2][1] - x[0][1];
5682
 
    
5683
 
    // Compute determinant of Jacobian
5684
 
    double detJ = J_00*J_11 - J_01*J_10;
5685
 
    
5686
 
    // Compute inverse of Jacobian
5687
 
    const double K_00 =  J_11 / detJ;
5688
 
    const double K_01 = -J_01 / detJ;
5689
 
    const double K_10 = -J_10 / detJ;
5690
 
    const double K_11 =  J_00 / detJ;
 
5670
    // Compute Jacobian
 
5671
    double J[4];
 
5672
    compute_jacobian_triangle_2d(J, vertex_coordinates);
 
5673
    
 
5674
    // Compute Jacobian inverse and determinant
 
5675
    double K[4];
 
5676
    double detJ;
 
5677
    compute_jacobian_inverse_triangle_2d(K, detJ, J);
 
5678
    
 
5679
    
5691
5680
    
5692
5681
    // Compute constants
5693
 
    const double C0 = x[1][0] + x[2][0];
5694
 
    const double C1 = x[1][1] + x[2][1];
 
5682
    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
 
5683
    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
5695
5684
    
5696
5685
    // Get coordinates and map to the reference (FIAT) element
5697
 
    double X = (J_01*(C1 - 2.0*coordinates[1]) + J_11*(2.0*coordinates[0] - C0)) / detJ;
5698
 
    double Y = (J_00*(2.0*coordinates[1] - C1) + J_10*(C0 - 2.0*coordinates[0])) / detJ;
 
5686
    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
 
5687
    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
5699
5688
    
5700
5689
    // Compute number of derivatives.
5701
5690
    unsigned int num_derivatives = 1;
5732
5721
    }
5733
5722
    
5734
5723
    // Compute inverse of Jacobian
5735
 
    const double Jinv[2][2] = {{K_00, K_01}, {K_10, K_11}};
 
5724
    const double Jinv[2][2] = {{K[0], K[1]}, {K[2], K[3]}};
5736
5725
    
5737
5726
    // Declare transformation matrix
5738
5727
    // Declare pointer to two dimensional array and initialise
5766
5755
    case 0:
5767
5756
      {
5768
5757
        
5769
 
      // Array of basisvalues.
 
5758
      // Array of basisvalues
5770
5759
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
5771
5760
      
5772
 
      // Declare helper variables.
 
5761
      // Declare helper variables
5773
5762
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
5774
5763
      double tmp1 = (1.0 - Y)/2.0;
5775
5764
      double tmp2 = tmp1*tmp1;
5776
5765
      
5777
 
      // Compute basisvalues.
 
5766
      // Compute basisvalues
5778
5767
      basisvalues[0] = 1.0;
5779
5768
      basisvalues[1] = tmp0;
5780
5769
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
5796
5785
      basisvalues[7] *= std::sqrt(10.0);
5797
5786
      basisvalues[6] *= std::sqrt(14.0);
5798
5787
      
5799
 
      // Table(s) of coefficients.
 
5788
      // Table(s) of coefficients
5800
5789
      static const double coefficients0[10] = \
5801
5790
      {0.18856181, 0.28867513, -0.16666667, 0.26082027, -0.20203051, 0.11664237, 0.1069045, -0.09035079, 0.069985421, -0.040406102};
5802
5791
      
5836
5825
        derivatives[r] = 0.0;
5837
5826
      }// end loop over 'r'
5838
5827
      
 
5828
      // Declare pointer to array of reference derivatives on physical element.
 
5829
      double *derivatives_p = new double[2*num_derivatives];
 
5830
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
5831
      {
 
5832
        derivatives_p[r] = 0.0;
 
5833
      }// end loop over 'r'
 
5834
      
5839
5835
      // Declare derivative matrix (of polynomial basis).
5840
5836
      double dmats[10][10] = \
5841
5837
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
5934
5930
        // Using contravariant Piola transform to map values back to the physical element.
5935
5931
        const double tmp_ref0 = derivatives[r];
5936
5932
        const double tmp_ref1 = derivatives[num_derivatives + r];
5937
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
5938
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
5933
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
5934
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
5939
5935
      }// end loop over 'r'
5940
5936
      
5941
5937
      // Transform derivatives back to physical element
5943
5939
      {
5944
5940
        for (unsigned int s = 0; s < num_derivatives; s++)
5945
5941
        {
5946
 
          values[r] += transform[r][s]*derivatives[s];
5947
 
          values[num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
5942
          values[r] += transform[r][s]*derivatives_p[s];
 
5943
          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
5948
5944
        }// end loop over 's'
5949
5945
      }// end loop over 'r'
5950
5946
      
5951
5947
      // Delete pointer to array of derivatives on FIAT element
5952
5948
      delete [] derivatives;
5953
5949
      
 
5950
      // Delete pointer to array of reference derivatives on physical element.
 
5951
      delete [] derivatives_p;
 
5952
      
5954
5953
      // Delete pointer to array of combinations of derivatives and transform
5955
5954
      for (unsigned int r = 0; r < num_derivatives; r++)
5956
5955
      {
5967
5966
    case 1:
5968
5967
      {
5969
5968
        
5970
 
      // Array of basisvalues.
 
5969
      // Array of basisvalues
5971
5970
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
5972
5971
      
5973
 
      // Declare helper variables.
 
5972
      // Declare helper variables
5974
5973
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
5975
5974
      double tmp1 = (1.0 - Y)/2.0;
5976
5975
      double tmp2 = tmp1*tmp1;
5977
5976
      
5978
 
      // Compute basisvalues.
 
5977
      // Compute basisvalues
5979
5978
      basisvalues[0] = 1.0;
5980
5979
      basisvalues[1] = tmp0;
5981
5980
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
5997
5996
      basisvalues[7] *= std::sqrt(10.0);
5998
5997
      basisvalues[6] *= std::sqrt(14.0);
5999
5998
      
6000
 
      // Table(s) of coefficients.
 
5999
      // Table(s) of coefficients
6001
6000
      static const double coefficients0[10] = \
6002
6001
      {-0.18856181, -0.25018512, 0.23333333, -0.10432811, 0.32324881, -0.25661321, 0.0, 0.12046772, -0.15552316, 0.1077496};
6003
6002
      
6037
6036
        derivatives[r] = 0.0;
6038
6037
      }// end loop over 'r'
6039
6038
      
 
6039
      // Declare pointer to array of reference derivatives on physical element.
 
6040
      double *derivatives_p = new double[2*num_derivatives];
 
6041
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
6042
      {
 
6043
        derivatives_p[r] = 0.0;
 
6044
      }// end loop over 'r'
 
6045
      
6040
6046
      // Declare derivative matrix (of polynomial basis).
6041
6047
      double dmats[10][10] = \
6042
6048
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
6135
6141
        // Using contravariant Piola transform to map values back to the physical element.
6136
6142
        const double tmp_ref0 = derivatives[r];
6137
6143
        const double tmp_ref1 = derivatives[num_derivatives + r];
6138
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
6139
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
6144
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
6145
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
6140
6146
      }// end loop over 'r'
6141
6147
      
6142
6148
      // Transform derivatives back to physical element
6144
6150
      {
6145
6151
        for (unsigned int s = 0; s < num_derivatives; s++)
6146
6152
        {
6147
 
          values[r] += transform[r][s]*derivatives[s];
6148
 
          values[num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
6153
          values[r] += transform[r][s]*derivatives_p[s];
 
6154
          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
6149
6155
        }// end loop over 's'
6150
6156
      }// end loop over 'r'
6151
6157
      
6152
6158
      // Delete pointer to array of derivatives on FIAT element
6153
6159
      delete [] derivatives;
6154
6160
      
 
6161
      // Delete pointer to array of reference derivatives on physical element.
 
6162
      delete [] derivatives_p;
 
6163
      
6155
6164
      // Delete pointer to array of combinations of derivatives and transform
6156
6165
      for (unsigned int r = 0; r < num_derivatives; r++)
6157
6166
      {
6168
6177
    case 2:
6169
6178
      {
6170
6179
        
6171
 
      // Array of basisvalues.
 
6180
      // Array of basisvalues
6172
6181
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
6173
6182
      
6174
 
      // Declare helper variables.
 
6183
      // Declare helper variables
6175
6184
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
6176
6185
      double tmp1 = (1.0 - Y)/2.0;
6177
6186
      double tmp2 = tmp1*tmp1;
6178
6187
      
6179
 
      // Compute basisvalues.
 
6188
      // Compute basisvalues
6180
6189
      basisvalues[0] = 1.0;
6181
6190
      basisvalues[1] = tmp0;
6182
6191
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
6198
6207
      basisvalues[7] *= std::sqrt(10.0);
6199
6208
      basisvalues[6] *= std::sqrt(14.0);
6200
6209
      
6201
 
      // Table(s) of coefficients.
 
6210
      // Table(s) of coefficients
6202
6211
      static const double coefficients0[10] = \
6203
6212
      {0.14142136, 0.096225045, -0.1, 0.0, -0.067343503, 0.15163508, 0.0, 0.0, 0.077761579, -0.080812204};
6204
6213
      
6238
6247
        derivatives[r] = 0.0;
6239
6248
      }// end loop over 'r'
6240
6249
      
 
6250
      // Declare pointer to array of reference derivatives on physical element.
 
6251
      double *derivatives_p = new double[2*num_derivatives];
 
6252
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
6253
      {
 
6254
        derivatives_p[r] = 0.0;
 
6255
      }// end loop over 'r'
 
6256
      
6241
6257
      // Declare derivative matrix (of polynomial basis).
6242
6258
      double dmats[10][10] = \
6243
6259
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
6336
6352
        // Using contravariant Piola transform to map values back to the physical element.
6337
6353
        const double tmp_ref0 = derivatives[r];
6338
6354
        const double tmp_ref1 = derivatives[num_derivatives + r];
6339
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
6340
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
6355
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
6356
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
6341
6357
      }// end loop over 'r'
6342
6358
      
6343
6359
      // Transform derivatives back to physical element
6345
6361
      {
6346
6362
        for (unsigned int s = 0; s < num_derivatives; s++)
6347
6363
        {
6348
 
          values[r] += transform[r][s]*derivatives[s];
6349
 
          values[num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
6364
          values[r] += transform[r][s]*derivatives_p[s];
 
6365
          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
6350
6366
        }// end loop over 's'
6351
6367
      }// end loop over 'r'
6352
6368
      
6353
6369
      // Delete pointer to array of derivatives on FIAT element
6354
6370
      delete [] derivatives;
6355
6371
      
 
6372
      // Delete pointer to array of reference derivatives on physical element.
 
6373
      delete [] derivatives_p;
 
6374
      
6356
6375
      // Delete pointer to array of combinations of derivatives and transform
6357
6376
      for (unsigned int r = 0; r < num_derivatives; r++)
6358
6377
      {
6369
6388
    case 3:
6370
6389
      {
6371
6390
        
6372
 
      // Array of basisvalues.
 
6391
      // Array of basisvalues
6373
6392
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
6374
6393
      
6375
 
      // Declare helper variables.
 
6394
      // Declare helper variables
6376
6395
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
6377
6396
      double tmp1 = (1.0 - Y)/2.0;
6378
6397
      double tmp2 = tmp1*tmp1;
6379
6398
      
6380
 
      // Compute basisvalues.
 
6399
      // Compute basisvalues
6381
6400
      basisvalues[0] = 1.0;
6382
6401
      basisvalues[1] = tmp0;
6383
6402
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
6399
6418
      basisvalues[7] *= std::sqrt(10.0);
6400
6419
      basisvalues[6] *= std::sqrt(14.0);
6401
6420
      
6402
 
      // Table(s) of coefficients.
 
6421
      // Table(s) of coefficients
6403
6422
      static const double coefficients0[10] = \
6404
6423
      {0.32998316, -0.25018512, -0.033333333, 0.33037234, 0.32324881, 0.20606818, -0.1069045, -0.03011693, 0.0077761579, 0.013468701};
6405
6424
      
6439
6458
        derivatives[r] = 0.0;
6440
6459
      }// end loop over 'r'
6441
6460
      
 
6461
      // Declare pointer to array of reference derivatives on physical element.
 
6462
      double *derivatives_p = new double[2*num_derivatives];
 
6463
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
6464
      {
 
6465
        derivatives_p[r] = 0.0;
 
6466
      }// end loop over 'r'
 
6467
      
6442
6468
      // Declare derivative matrix (of polynomial basis).
6443
6469
      double dmats[10][10] = \
6444
6470
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
6537
6563
        // Using contravariant Piola transform to map values back to the physical element.
6538
6564
        const double tmp_ref0 = derivatives[r];
6539
6565
        const double tmp_ref1 = derivatives[num_derivatives + r];
6540
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
6541
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
6566
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
6567
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
6542
6568
      }// end loop over 'r'
6543
6569
      
6544
6570
      // Transform derivatives back to physical element
6546
6572
      {
6547
6573
        for (unsigned int s = 0; s < num_derivatives; s++)
6548
6574
        {
6549
 
          values[r] += transform[r][s]*derivatives[s];
6550
 
          values[num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
6575
          values[r] += transform[r][s]*derivatives_p[s];
 
6576
          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
6551
6577
        }// end loop over 's'
6552
6578
      }// end loop over 'r'
6553
6579
      
6554
6580
      // Delete pointer to array of derivatives on FIAT element
6555
6581
      delete [] derivatives;
6556
6582
      
 
6583
      // Delete pointer to array of reference derivatives on physical element.
 
6584
      delete [] derivatives_p;
 
6585
      
6557
6586
      // Delete pointer to array of combinations of derivatives and transform
6558
6587
      for (unsigned int r = 0; r < num_derivatives; r++)
6559
6588
      {
6570
6599
    case 4:
6571
6600
      {
6572
6601
        
6573
 
      // Array of basisvalues.
 
6602
      // Array of basisvalues
6574
6603
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
6575
6604
      
6576
 
      // Declare helper variables.
 
6605
      // Declare helper variables
6577
6606
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
6578
6607
      double tmp1 = (1.0 - Y)/2.0;
6579
6608
      double tmp2 = tmp1*tmp1;
6580
6609
      
6581
 
      // Compute basisvalues.
 
6610
      // Compute basisvalues
6582
6611
      basisvalues[0] = 1.0;
6583
6612
      basisvalues[1] = tmp0;
6584
6613
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
6600
6629
      basisvalues[7] *= std::sqrt(10.0);
6601
6630
      basisvalues[6] *= std::sqrt(14.0);
6602
6631
      
6603
 
      // Table(s) of coefficients.
 
6632
      // Table(s) of coefficients
6604
6633
      static const double coefficients0[10] = \
6605
6634
      {-0.37712362, 0.17320508, -0.1, -0.10432811, -0.56568542, -0.60654032, 0.0, 0.12046772, 0.0, -0.053874802};
6606
6635
      
6640
6669
        derivatives[r] = 0.0;
6641
6670
      }// end loop over 'r'
6642
6671
      
 
6672
      // Declare pointer to array of reference derivatives on physical element.
 
6673
      double *derivatives_p = new double[2*num_derivatives];
 
6674
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
6675
      {
 
6676
        derivatives_p[r] = 0.0;
 
6677
      }// end loop over 'r'
 
6678
      
6643
6679
      // Declare derivative matrix (of polynomial basis).
6644
6680
      double dmats[10][10] = \
6645
6681
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
6738
6774
        // Using contravariant Piola transform to map values back to the physical element.
6739
6775
        const double tmp_ref0 = derivatives[r];
6740
6776
        const double tmp_ref1 = derivatives[num_derivatives + r];
6741
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
6742
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
6777
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
6778
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
6743
6779
      }// end loop over 'r'
6744
6780
      
6745
6781
      // Transform derivatives back to physical element
6747
6783
      {
6748
6784
        for (unsigned int s = 0; s < num_derivatives; s++)
6749
6785
        {
6750
 
          values[r] += transform[r][s]*derivatives[s];
6751
 
          values[num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
6786
          values[r] += transform[r][s]*derivatives_p[s];
 
6787
          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
6752
6788
        }// end loop over 's'
6753
6789
      }// end loop over 'r'
6754
6790
      
6755
6791
      // Delete pointer to array of derivatives on FIAT element
6756
6792
      delete [] derivatives;
6757
6793
      
 
6794
      // Delete pointer to array of reference derivatives on physical element.
 
6795
      delete [] derivatives_p;
 
6796
      
6758
6797
      // Delete pointer to array of combinations of derivatives and transform
6759
6798
      for (unsigned int r = 0; r < num_derivatives; r++)
6760
6799
      {
6771
6810
    case 5:
6772
6811
      {
6773
6812
        
6774
 
      // Array of basisvalues.
 
6813
      // Array of basisvalues
6775
6814
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
6776
6815
      
6777
 
      // Declare helper variables.
 
6816
      // Declare helper variables
6778
6817
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
6779
6818
      double tmp1 = (1.0 - Y)/2.0;
6780
6819
      double tmp2 = tmp1*tmp1;
6781
6820
      
6782
 
      // Compute basisvalues.
 
6821
      // Compute basisvalues
6783
6822
      basisvalues[0] = 1.0;
6784
6823
      basisvalues[1] = tmp0;
6785
6824
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
6801
6840
      basisvalues[7] *= std::sqrt(10.0);
6802
6841
      basisvalues[6] *= std::sqrt(14.0);
6803
6842
      
6804
 
      // Table(s) of coefficients.
 
6843
      // Table(s) of coefficients
6805
6844
      static const double coefficients0[10] = \
6806
6845
      {0.32998316, -0.096225045, 0.23333333, 0.0, 0.067343503, 0.50156219, 0.0, 0.0, -0.077761579, 0.080812204};
6807
6846
      
6841
6880
        derivatives[r] = 0.0;
6842
6881
      }// end loop over 'r'
6843
6882
      
 
6883
      // Declare pointer to array of reference derivatives on physical element.
 
6884
      double *derivatives_p = new double[2*num_derivatives];
 
6885
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
6886
      {
 
6887
        derivatives_p[r] = 0.0;
 
6888
      }// end loop over 'r'
 
6889
      
6844
6890
      // Declare derivative matrix (of polynomial basis).
6845
6891
      double dmats[10][10] = \
6846
6892
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
6939
6985
        // Using contravariant Piola transform to map values back to the physical element.
6940
6986
        const double tmp_ref0 = derivatives[r];
6941
6987
        const double tmp_ref1 = derivatives[num_derivatives + r];
6942
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
6943
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
6988
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
6989
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
6944
6990
      }// end loop over 'r'
6945
6991
      
6946
6992
      // Transform derivatives back to physical element
6948
6994
      {
6949
6995
        for (unsigned int s = 0; s < num_derivatives; s++)
6950
6996
        {
6951
 
          values[r] += transform[r][s]*derivatives[s];
6952
 
          values[num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
6997
          values[r] += transform[r][s]*derivatives_p[s];
 
6998
          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
6953
6999
        }// end loop over 's'
6954
7000
      }// end loop over 'r'
6955
7001
      
6956
7002
      // Delete pointer to array of derivatives on FIAT element
6957
7003
      delete [] derivatives;
6958
7004
      
 
7005
      // Delete pointer to array of reference derivatives on physical element.
 
7006
      delete [] derivatives_p;
 
7007
      
6959
7008
      // Delete pointer to array of combinations of derivatives and transform
6960
7009
      for (unsigned int r = 0; r < num_derivatives; r++)
6961
7010
      {
6972
7021
    case 6:
6973
7022
      {
6974
7023
        
6975
 
      // Array of basisvalues.
 
7024
      // Array of basisvalues
6976
7025
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
6977
7026
      
6978
 
      // Declare helper variables.
 
7027
      // Declare helper variables
6979
7028
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
6980
7029
      double tmp1 = (1.0 - Y)/2.0;
6981
7030
      double tmp2 = tmp1*tmp1;
6982
7031
      
6983
 
      // Compute basisvalues.
 
7032
      // Compute basisvalues
6984
7033
      basisvalues[0] = 1.0;
6985
7034
      basisvalues[1] = tmp0;
6986
7035
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
7002
7051
      basisvalues[7] *= std::sqrt(10.0);
7003
7052
      basisvalues[6] *= std::sqrt(14.0);
7004
7053
      
7005
 
      // Table(s) of coefficients.
 
7054
      // Table(s) of coefficients
7006
7055
      static const double coefficients0[10] = \
7007
7056
      {0.14142136, 0.13471506, -0.033333333, 0.15649216, 0.053874802, 0.011664237, 0.1069045, 0.03011693, -0.0077761579, -0.013468701};
7008
7057
      
7042
7091
        derivatives[r] = 0.0;
7043
7092
      }// end loop over 'r'
7044
7093
      
 
7094
      // Declare pointer to array of reference derivatives on physical element.
 
7095
      double *derivatives_p = new double[2*num_derivatives];
 
7096
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
7097
      {
 
7098
        derivatives_p[r] = 0.0;
 
7099
      }// end loop over 'r'
 
7100
      
7045
7101
      // Declare derivative matrix (of polynomial basis).
7046
7102
      double dmats[10][10] = \
7047
7103
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
7140
7196
        // Using contravariant Piola transform to map values back to the physical element.
7141
7197
        const double tmp_ref0 = derivatives[r];
7142
7198
        const double tmp_ref1 = derivatives[num_derivatives + r];
7143
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
7144
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
7199
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
7200
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
7145
7201
      }// end loop over 'r'
7146
7202
      
7147
7203
      // Transform derivatives back to physical element
7149
7205
      {
7150
7206
        for (unsigned int s = 0; s < num_derivatives; s++)
7151
7207
        {
7152
 
          values[r] += transform[r][s]*derivatives[s];
7153
 
          values[num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
7208
          values[r] += transform[r][s]*derivatives_p[s];
 
7209
          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
7154
7210
        }// end loop over 's'
7155
7211
      }// end loop over 'r'
7156
7212
      
7157
7213
      // Delete pointer to array of derivatives on FIAT element
7158
7214
      delete [] derivatives;
7159
7215
      
 
7216
      // Delete pointer to array of reference derivatives on physical element.
 
7217
      delete [] derivatives_p;
 
7218
      
7160
7219
      // Delete pointer to array of combinations of derivatives and transform
7161
7220
      for (unsigned int r = 0; r < num_derivatives; r++)
7162
7221
      {
7173
7232
    case 7:
7174
7233
      {
7175
7234
        
7176
 
      // Array of basisvalues.
 
7235
      // Array of basisvalues
7177
7236
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
7178
7237
      
7179
 
      // Declare helper variables.
 
7238
      // Declare helper variables
7180
7239
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
7181
7240
      double tmp1 = (1.0 - Y)/2.0;
7182
7241
      double tmp2 = tmp1*tmp1;
7183
7242
      
7184
 
      // Compute basisvalues.
 
7243
      // Compute basisvalues
7185
7244
      basisvalues[0] = 1.0;
7186
7245
      basisvalues[1] = tmp0;
7187
7246
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
7203
7262
      basisvalues[7] *= std::sqrt(10.0);
7204
7263
      basisvalues[6] *= std::sqrt(14.0);
7205
7264
      
7206
 
      // Table(s) of coefficients.
 
7265
      // Table(s) of coefficients
7207
7266
      static const double coefficients0[10] = \
7208
7267
      {-0.18856181, -0.32716515, 0.1, -0.41731242, 0.080812204, 0.023328474, -0.21380899, 0.06023386, 0.015552316, -0.026937401};
7209
7268
      
7243
7302
        derivatives[r] = 0.0;
7244
7303
      }// end loop over 'r'
7245
7304
      
 
7305
      // Declare pointer to array of reference derivatives on physical element.
 
7306
      double *derivatives_p = new double[2*num_derivatives];
 
7307
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
7308
      {
 
7309
        derivatives_p[r] = 0.0;
 
7310
      }// end loop over 'r'
 
7311
      
7246
7312
      // Declare derivative matrix (of polynomial basis).
7247
7313
      double dmats[10][10] = \
7248
7314
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
7341
7407
        // Using contravariant Piola transform to map values back to the physical element.
7342
7408
        const double tmp_ref0 = derivatives[r];
7343
7409
        const double tmp_ref1 = derivatives[num_derivatives + r];
7344
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
7345
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
7410
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
7411
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
7346
7412
      }// end loop over 'r'
7347
7413
      
7348
7414
      // Transform derivatives back to physical element
7350
7416
      {
7351
7417
        for (unsigned int s = 0; s < num_derivatives; s++)
7352
7418
        {
7353
 
          values[r] += transform[r][s]*derivatives[s];
7354
 
          values[num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
7419
          values[r] += transform[r][s]*derivatives_p[s];
 
7420
          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
7355
7421
        }// end loop over 's'
7356
7422
      }// end loop over 'r'
7357
7423
      
7358
7424
      // Delete pointer to array of derivatives on FIAT element
7359
7425
      delete [] derivatives;
7360
7426
      
 
7427
      // Delete pointer to array of reference derivatives on physical element.
 
7428
      delete [] derivatives_p;
 
7429
      
7361
7430
      // Delete pointer to array of combinations of derivatives and transform
7362
7431
      for (unsigned int r = 0; r < num_derivatives; r++)
7363
7432
      {
7374
7443
    case 8:
7375
7444
      {
7376
7445
        
7377
 
      // Array of basisvalues.
 
7446
      // Array of basisvalues
7378
7447
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
7379
7448
      
7380
 
      // Declare helper variables.
 
7449
      // Declare helper variables
7381
7450
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
7382
7451
      double tmp1 = (1.0 - Y)/2.0;
7383
7452
      double tmp2 = tmp1*tmp1;
7384
7453
      
7385
 
      // Compute basisvalues.
 
7454
      // Compute basisvalues
7386
7455
      basisvalues[0] = 1.0;
7387
7456
      basisvalues[1] = tmp0;
7388
7457
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
7404
7473
      basisvalues[7] *= std::sqrt(10.0);
7405
7474
      basisvalues[6] *= std::sqrt(14.0);
7406
7475
      
7407
 
      // Table(s) of coefficients.
 
7476
      // Table(s) of coefficients
7408
7477
      static const double coefficients0[10] = \
7409
7478
      {0.18856181, 0.28867513, -0.16666667, 0.26082027, -0.20203051, 0.11664237, 0.1069045, -0.09035079, 0.069985421, -0.040406102};
7410
7479
      
7444
7513
        derivatives[r] = 0.0;
7445
7514
      }// end loop over 'r'
7446
7515
      
 
7516
      // Declare pointer to array of reference derivatives on physical element.
 
7517
      double *derivatives_p = new double[2*num_derivatives];
 
7518
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
7519
      {
 
7520
        derivatives_p[r] = 0.0;
 
7521
      }// end loop over 'r'
 
7522
      
7447
7523
      // Declare derivative matrix (of polynomial basis).
7448
7524
      double dmats[10][10] = \
7449
7525
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
7542
7618
        // Using contravariant Piola transform to map values back to the physical element.
7543
7619
        const double tmp_ref0 = derivatives[r];
7544
7620
        const double tmp_ref1 = derivatives[num_derivatives + r];
7545
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
7546
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
7621
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
7622
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
7547
7623
      }// end loop over 'r'
7548
7624
      
7549
7625
      // Transform derivatives back to physical element
7551
7627
      {
7552
7628
        for (unsigned int s = 0; s < num_derivatives; s++)
7553
7629
        {
7554
 
          values[r] += transform[r][s]*derivatives[s];
7555
 
          values[num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
7630
          values[r] += transform[r][s]*derivatives_p[s];
 
7631
          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
7556
7632
        }// end loop over 's'
7557
7633
      }// end loop over 'r'
7558
7634
      
7559
7635
      // Delete pointer to array of derivatives on FIAT element
7560
7636
      delete [] derivatives;
7561
7637
      
 
7638
      // Delete pointer to array of reference derivatives on physical element.
 
7639
      delete [] derivatives_p;
 
7640
      
7562
7641
      // Delete pointer to array of combinations of derivatives and transform
7563
7642
      for (unsigned int r = 0; r < num_derivatives; r++)
7564
7643
      {
7575
7654
    case 9:
7576
7655
      {
7577
7656
        
7578
 
      // Array of basisvalues.
 
7657
      // Array of basisvalues
7579
7658
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
7580
7659
      
7581
 
      // Declare helper variables.
 
7660
      // Declare helper variables
7582
7661
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
7583
7662
      double tmp1 = (1.0 - Y)/2.0;
7584
7663
      double tmp2 = tmp1*tmp1;
7585
7664
      
7586
 
      // Compute basisvalues.
 
7665
      // Compute basisvalues
7587
7666
      basisvalues[0] = 1.0;
7588
7667
      basisvalues[1] = tmp0;
7589
7668
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
7605
7684
      basisvalues[7] *= std::sqrt(10.0);
7606
7685
      basisvalues[6] *= std::sqrt(14.0);
7607
7686
      
7608
 
      // Table(s) of coefficients.
 
7687
      // Table(s) of coefficients
7609
7688
      static const double coefficients0[10] = \
7610
7689
      {0.32998316, -0.69282032, -0.53333333, -0.39992441, -0.026937401, 0.20606818, 0.32071349, -0.03011693, -0.023328474, 0.013468701};
7611
7690
      
7645
7724
        derivatives[r] = 0.0;
7646
7725
      }// end loop over 'r'
7647
7726
      
 
7727
      // Declare pointer to array of reference derivatives on physical element.
 
7728
      double *derivatives_p = new double[2*num_derivatives];
 
7729
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
7730
      {
 
7731
        derivatives_p[r] = 0.0;
 
7732
      }// end loop over 'r'
 
7733
      
7648
7734
      // Declare derivative matrix (of polynomial basis).
7649
7735
      double dmats[10][10] = \
7650
7736
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
7743
7829
        // Using contravariant Piola transform to map values back to the physical element.
7744
7830
        const double tmp_ref0 = derivatives[r];
7745
7831
        const double tmp_ref1 = derivatives[num_derivatives + r];
7746
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
7747
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
7832
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
7833
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
7748
7834
      }// end loop over 'r'
7749
7835
      
7750
7836
      // Transform derivatives back to physical element
7752
7838
      {
7753
7839
        for (unsigned int s = 0; s < num_derivatives; s++)
7754
7840
        {
7755
 
          values[r] += transform[r][s]*derivatives[s];
7756
 
          values[num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
7841
          values[r] += transform[r][s]*derivatives_p[s];
 
7842
          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
7757
7843
        }// end loop over 's'
7758
7844
      }// end loop over 'r'
7759
7845
      
7760
7846
      // Delete pointer to array of derivatives on FIAT element
7761
7847
      delete [] derivatives;
7762
7848
      
 
7849
      // Delete pointer to array of reference derivatives on physical element.
 
7850
      delete [] derivatives_p;
 
7851
      
7763
7852
      // Delete pointer to array of combinations of derivatives and transform
7764
7853
      for (unsigned int r = 0; r < num_derivatives; r++)
7765
7854
      {
7776
7865
    case 10:
7777
7866
      {
7778
7867
        
7779
 
      // Array of basisvalues.
 
7868
      // Array of basisvalues
7780
7869
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
7781
7870
      
7782
 
      // Declare helper variables.
 
7871
      // Declare helper variables
7783
7872
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
7784
7873
      double tmp1 = (1.0 - Y)/2.0;
7785
7874
      double tmp2 = tmp1*tmp1;
7786
7875
      
7787
 
      // Compute basisvalues.
 
7876
      // Compute basisvalues
7788
7877
      basisvalues[0] = 1.0;
7789
7878
      basisvalues[1] = tmp0;
7790
7879
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
7806
7895
      basisvalues[7] *= std::sqrt(10.0);
7807
7896
      basisvalues[6] *= std::sqrt(14.0);
7808
7897
      
7809
 
      // Table(s) of coefficients.
 
7898
      // Table(s) of coefficients
7810
7899
      static const double coefficients0[10] = \
7811
7900
      {0.56568542, 0.65433031, -0.46666667, -0.19126819, -0.094280904, 0.12441853, -0.32071349, 0.15058465, -0.054433105, 0.013468701};
7812
7901
      
7846
7935
        derivatives[r] = 0.0;
7847
7936
      }// end loop over 'r'
7848
7937
      
 
7938
      // Declare pointer to array of reference derivatives on physical element.
 
7939
      double *derivatives_p = new double[2*num_derivatives];
 
7940
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
7941
      {
 
7942
        derivatives_p[r] = 0.0;
 
7943
      }// end loop over 'r'
 
7944
      
7849
7945
      // Declare derivative matrix (of polynomial basis).
7850
7946
      double dmats[10][10] = \
7851
7947
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
7944
8040
        // Using contravariant Piola transform to map values back to the physical element.
7945
8041
        const double tmp_ref0 = derivatives[r];
7946
8042
        const double tmp_ref1 = derivatives[num_derivatives + r];
7947
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
7948
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
8043
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
8044
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
7949
8045
      }// end loop over 'r'
7950
8046
      
7951
8047
      // Transform derivatives back to physical element
7953
8049
      {
7954
8050
        for (unsigned int s = 0; s < num_derivatives; s++)
7955
8051
        {
7956
 
          values[r] += transform[r][s]*derivatives[s];
7957
 
          values[num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
8052
          values[r] += transform[r][s]*derivatives_p[s];
 
8053
          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
7958
8054
        }// end loop over 's'
7959
8055
      }// end loop over 'r'
7960
8056
      
7961
8057
      // Delete pointer to array of derivatives on FIAT element
7962
8058
      delete [] derivatives;
7963
8059
      
 
8060
      // Delete pointer to array of reference derivatives on physical element.
 
8061
      delete [] derivatives_p;
 
8062
      
7964
8063
      // Delete pointer to array of combinations of derivatives and transform
7965
8064
      for (unsigned int r = 0; r < num_derivatives; r++)
7966
8065
      {
7977
8076
    case 11:
7978
8077
      {
7979
8078
        
7980
 
      // Array of basisvalues.
 
8079
      // Array of basisvalues
7981
8080
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
7982
8081
      
7983
 
      // Declare helper variables.
 
8082
      // Declare helper variables
7984
8083
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
7985
8084
      double tmp1 = (1.0 - Y)/2.0;
7986
8085
      double tmp2 = tmp1*tmp1;
7987
8086
      
7988
 
      // Compute basisvalues.
 
8087
      // Compute basisvalues
7989
8088
      basisvalues[0] = 1.0;
7990
8089
      basisvalues[1] = tmp0;
7991
8090
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
8007
8106
      basisvalues[7] *= std::sqrt(10.0);
8008
8107
      basisvalues[6] *= std::sqrt(14.0);
8009
8108
      
8010
 
      // Table(s) of coefficients.
 
8109
      // Table(s) of coefficients
8011
8110
      static const double coefficients0[10] = \
8012
8111
      {0.094280904, 0.076980036, 0.93333333, 0.20865621, 0.24243661, -0.443241, 0.0, -0.24093544, 0.15552316, -0.053874802};
8013
8112
      
8047
8146
        derivatives[r] = 0.0;
8048
8147
      }// end loop over 'r'
8049
8148
      
 
8149
      // Declare pointer to array of reference derivatives on physical element.
 
8150
      double *derivatives_p = new double[2*num_derivatives];
 
8151
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
8152
      {
 
8153
        derivatives_p[r] = 0.0;
 
8154
      }// end loop over 'r'
 
8155
      
8050
8156
      // Declare derivative matrix (of polynomial basis).
8051
8157
      double dmats[10][10] = \
8052
8158
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8145
8251
        // Using contravariant Piola transform to map values back to the physical element.
8146
8252
        const double tmp_ref0 = derivatives[r];
8147
8253
        const double tmp_ref1 = derivatives[num_derivatives + r];
8148
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
8149
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
8254
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
8255
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
8150
8256
      }// end loop over 'r'
8151
8257
      
8152
8258
      // Transform derivatives back to physical element
8154
8260
      {
8155
8261
        for (unsigned int s = 0; s < num_derivatives; s++)
8156
8262
        {
8157
 
          values[r] += transform[r][s]*derivatives[s];
8158
 
          values[num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
8263
          values[r] += transform[r][s]*derivatives_p[s];
 
8264
          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
8159
8265
        }// end loop over 's'
8160
8266
      }// end loop over 'r'
8161
8267
      
8162
8268
      // Delete pointer to array of derivatives on FIAT element
8163
8269
      delete [] derivatives;
8164
8270
      
 
8271
      // Delete pointer to array of reference derivatives on physical element.
 
8272
      delete [] derivatives_p;
 
8273
      
8165
8274
      // Delete pointer to array of combinations of derivatives and transform
8166
8275
      for (unsigned int r = 0; r < num_derivatives; r++)
8167
8276
      {
8178
8287
    case 12:
8179
8288
      {
8180
8289
        
8181
 
      // Array of basisvalues.
 
8290
      // Array of basisvalues
8182
8291
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
8183
8292
      
8184
 
      // Declare helper variables.
 
8293
      // Declare helper variables
8185
8294
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
8186
8295
      double tmp1 = (1.0 - Y)/2.0;
8187
8296
      double tmp2 = tmp1*tmp1;
8188
8297
      
8189
 
      // Compute basisvalues.
 
8298
      // Compute basisvalues
8190
8299
      basisvalues[0] = 1.0;
8191
8300
      basisvalues[1] = tmp0;
8192
8301
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
8208
8317
      basisvalues[7] *= std::sqrt(10.0);
8209
8318
      basisvalues[6] *= std::sqrt(14.0);
8210
8319
      
8211
 
      // Table(s) of coefficients.
 
8320
      // Table(s) of coefficients
8212
8321
      static const double coefficients0[10] = \
8213
8322
      {0.23570226, 0.076980036, 0.0, 0.052164053, 0.24243661, 0.058321184, 0.1069045, 0.15058465, -0.0077761579, -0.067343503};
8214
8323
      
8248
8357
        derivatives[r] = 0.0;
8249
8358
      }// end loop over 'r'
8250
8359
      
 
8360
      // Declare pointer to array of reference derivatives on physical element.
 
8361
      double *derivatives_p = new double[2*num_derivatives];
 
8362
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
8363
      {
 
8364
        derivatives_p[r] = 0.0;
 
8365
      }// end loop over 'r'
 
8366
      
8251
8367
      // Declare derivative matrix (of polynomial basis).
8252
8368
      double dmats[10][10] = \
8253
8369
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8346
8462
        // Using contravariant Piola transform to map values back to the physical element.
8347
8463
        const double tmp_ref0 = derivatives[r];
8348
8464
        const double tmp_ref1 = derivatives[num_derivatives + r];
8349
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
8350
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
8465
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
8466
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
8351
8467
      }// end loop over 'r'
8352
8468
      
8353
8469
      // Transform derivatives back to physical element
8355
8471
      {
8356
8472
        for (unsigned int s = 0; s < num_derivatives; s++)
8357
8473
        {
8358
 
          values[r] += transform[r][s]*derivatives[s];
8359
 
          values[num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
8474
          values[r] += transform[r][s]*derivatives_p[s];
 
8475
          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
8360
8476
        }// end loop over 's'
8361
8477
      }// end loop over 'r'
8362
8478
      
8363
8479
      // Delete pointer to array of derivatives on FIAT element
8364
8480
      delete [] derivatives;
8365
8481
      
 
8482
      // Delete pointer to array of reference derivatives on physical element.
 
8483
      delete [] derivatives_p;
 
8484
      
8366
8485
      // Delete pointer to array of combinations of derivatives and transform
8367
8486
      for (unsigned int r = 0; r < num_derivatives; r++)
8368
8487
      {
8379
8498
    case 13:
8380
8499
      {
8381
8500
        
8382
 
      // Array of basisvalues.
 
8501
      // Array of basisvalues
8383
8502
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
8384
8503
      
8385
 
      // Declare helper variables.
 
8504
      // Declare helper variables
8386
8505
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
8387
8506
      double tmp1 = (1.0 - Y)/2.0;
8388
8507
      double tmp2 = tmp1*tmp1;
8389
8508
      
8390
 
      // Compute basisvalues.
 
8509
      // Compute basisvalues
8391
8510
      basisvalues[0] = 1.0;
8392
8511
      basisvalues[1] = tmp0;
8393
8512
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
8409
8528
      basisvalues[7] *= std::sqrt(10.0);
8410
8529
      basisvalues[6] *= std::sqrt(14.0);
8411
8530
      
8412
 
      // Table(s) of coefficients.
 
8531
      // Table(s) of coefficients
8413
8532
      static const double coefficients0[10] = \
8414
8533
      {0.0, -0.076980036, -0.13333333, -0.31298432, -0.24243661, 0.27994168, -0.21380899, -0.06023386, 0.17107547, -0.13468701};
8415
8534
      
8449
8568
        derivatives[r] = 0.0;
8450
8569
      }// end loop over 'r'
8451
8570
      
 
8571
      // Declare pointer to array of reference derivatives on physical element.
 
8572
      double *derivatives_p = new double[2*num_derivatives];
 
8573
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
8574
      {
 
8575
        derivatives_p[r] = 0.0;
 
8576
      }// end loop over 'r'
 
8577
      
8452
8578
      // Declare derivative matrix (of polynomial basis).
8453
8579
      double dmats[10][10] = \
8454
8580
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8547
8673
        // Using contravariant Piola transform to map values back to the physical element.
8548
8674
        const double tmp_ref0 = derivatives[r];
8549
8675
        const double tmp_ref1 = derivatives[num_derivatives + r];
8550
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
8551
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
8676
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
8677
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
8552
8678
      }// end loop over 'r'
8553
8679
      
8554
8680
      // Transform derivatives back to physical element
8556
8682
      {
8557
8683
        for (unsigned int s = 0; s < num_derivatives; s++)
8558
8684
        {
8559
 
          values[r] += transform[r][s]*derivatives[s];
8560
 
          values[num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
8685
          values[r] += transform[r][s]*derivatives_p[s];
 
8686
          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
8561
8687
        }// end loop over 's'
8562
8688
      }// end loop over 'r'
8563
8689
      
8564
8690
      // Delete pointer to array of derivatives on FIAT element
8565
8691
      delete [] derivatives;
8566
8692
      
 
8693
      // Delete pointer to array of reference derivatives on physical element.
 
8694
      delete [] derivatives_p;
 
8695
      
8567
8696
      // Delete pointer to array of combinations of derivatives and transform
8568
8697
      for (unsigned int r = 0; r < num_derivatives; r++)
8569
8698
      {
8580
8709
    case 14:
8581
8710
      {
8582
8711
        
8583
 
      // Array of basisvalues.
 
8712
      // Array of basisvalues
8584
8713
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
8585
8714
      
8586
 
      // Declare helper variables.
 
8715
      // Declare helper variables
8587
8716
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
8588
8717
      double tmp1 = (1.0 - Y)/2.0;
8589
8718
      double tmp2 = tmp1*tmp1;
8590
8719
      
8591
 
      // Compute basisvalues.
 
8720
      // Compute basisvalues
8592
8721
      basisvalues[0] = 1.0;
8593
8722
      basisvalues[1] = tmp0;
8594
8723
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
8610
8739
      basisvalues[7] *= std::sqrt(10.0);
8611
8740
      basisvalues[6] *= std::sqrt(14.0);
8612
8741
      
8613
 
      // Table(s) of coefficients.
 
8742
      // Table(s) of coefficients
8614
8743
      static const double coefficients0[10] = \
8615
8744
      {-0.23570226, -0.038490018, 0.066666667, 0.10432811, -0.12121831, -0.19829203, 0.0, -0.12046772, -0.077761579, 0.13468701};
8616
8745
      
8650
8779
        derivatives[r] = 0.0;
8651
8780
      }// end loop over 'r'
8652
8781
      
 
8782
      // Declare pointer to array of reference derivatives on physical element.
 
8783
      double *derivatives_p = new double[2*num_derivatives];
 
8784
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
8785
      {
 
8786
        derivatives_p[r] = 0.0;
 
8787
      }// end loop over 'r'
 
8788
      
8653
8789
      // Declare derivative matrix (of polynomial basis).
8654
8790
      double dmats[10][10] = \
8655
8791
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8748
8884
        // Using contravariant Piola transform to map values back to the physical element.
8749
8885
        const double tmp_ref0 = derivatives[r];
8750
8886
        const double tmp_ref1 = derivatives[num_derivatives + r];
8751
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
8752
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
8887
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
8888
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
8753
8889
      }// end loop over 'r'
8754
8890
      
8755
8891
      // Transform derivatives back to physical element
8757
8893
      {
8758
8894
        for (unsigned int s = 0; s < num_derivatives; s++)
8759
8895
        {
8760
 
          values[r] += transform[r][s]*derivatives[s];
8761
 
          values[num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
8896
          values[r] += transform[r][s]*derivatives_p[s];
 
8897
          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
8762
8898
        }// end loop over 's'
8763
8899
      }// end loop over 'r'
8764
8900
      
8765
8901
      // Delete pointer to array of derivatives on FIAT element
8766
8902
      delete [] derivatives;
8767
8903
      
 
8904
      // Delete pointer to array of reference derivatives on physical element.
 
8905
      delete [] derivatives_p;
 
8906
      
8768
8907
      // Delete pointer to array of combinations of derivatives and transform
8769
8908
      for (unsigned int r = 0; r < num_derivatives; r++)
8770
8909
      {
8782
8921
    
8783
8922
  }
8784
8923
 
8785
 
  /// Evaluate order n derivatives of all basis functions at given point in cell
8786
 
  virtual void evaluate_basis_derivatives_all(unsigned int n,
 
8924
  /// Evaluate order n derivatives of all basis functions at given point x in cell
 
8925
  virtual void evaluate_basis_derivatives_all(std::size_t n,
8787
8926
                                              double* values,
8788
 
                                              const double* coordinates,
8789
 
                                              const ufc::cell& c) const
 
8927
                                              const double* x,
 
8928
                                              const double* vertex_coordinates,
 
8929
                                              int cell_orientation) const
8790
8930
  {
8791
8931
    // Compute number of derivatives.
8792
8932
    unsigned int num_derivatives = 1;
8805
8945
    // Loop dofs and call evaluate_basis_derivatives.
8806
8946
    for (unsigned int r = 0; r < 15; r++)
8807
8947
    {
8808
 
      evaluate_basis_derivatives(r, n, dof_values, coordinates, c);
 
8948
      evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
8809
8949
      for (unsigned int s = 0; s < 2*num_derivatives; s++)
8810
8950
      {
8811
8951
        values[r*2*num_derivatives + s] = dof_values[s];
8817
8957
  }
8818
8958
 
8819
8959
  /// Evaluate linear functional for dof i on the function f
8820
 
  virtual double evaluate_dof(unsigned int i,
 
8960
  virtual double evaluate_dof(std::size_t i,
8821
8961
                              const ufc::function& f,
 
8962
                              const double* vertex_coordinates,
 
8963
                              int cell_orientation,
8822
8964
                              const ufc::cell& c) const
8823
8965
  {
8824
 
    // Declare variables for result of evaluation.
 
8966
    // Declare variables for result of evaluation
8825
8967
    double vals[2];
8826
8968
    
8827
 
    // Declare variable for physical coordinates.
 
8969
    // Declare variable for physical coordinates
8828
8970
    double y[2];
 
8971
    
8829
8972
    double result;
8830
 
    // Extract vertex coordinates
8831
 
    const double * const * x = c.coordinates;
8832
 
    
8833
 
    // Compute Jacobian of affine map from reference cell
8834
 
    const double J_00 = x[1][0] - x[0][0];
8835
 
    const double J_01 = x[2][0] - x[0][0];
8836
 
    const double J_10 = x[1][1] - x[0][1];
8837
 
    const double J_11 = x[2][1] - x[0][1];
8838
 
    
8839
 
    // Compute determinant of Jacobian
8840
 
    double detJ = J_00*J_11 - J_01*J_10;
8841
 
    
8842
 
    // Compute inverse of Jacobian
8843
 
    const double K_00 =  J_11 / detJ;
8844
 
    const double K_01 = -J_01 / detJ;
8845
 
    const double K_10 = -J_10 / detJ;
8846
 
    const double K_11 =  J_00 / detJ;switch (i)
 
8973
    // Compute Jacobian
 
8974
    double J[4];
 
8975
    compute_jacobian_triangle_2d(J, vertex_coordinates);
 
8976
    
 
8977
    
 
8978
    // Compute Jacobian inverse and determinant
 
8979
    double K[4];
 
8980
    double detJ;
 
8981
    compute_jacobian_inverse_triangle_2d(K, detJ, J);
 
8982
    
 
8983
    
 
8984
    switch (i)
8847
8985
    {
8848
8986
    case 0:
8849
8987
      {
8850
 
        y[0] = 0.75*x[1][0] + 0.25*x[2][0];
8851
 
      y[1] = 0.75*x[1][1] + 0.25*x[2][1];
 
8988
        y[0] = 0.75*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
8989
      y[1] = 0.75*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
8852
8990
      f.evaluate(vals, y, c);
8853
 
      result = (detJ*(K_00*vals[0] + K_01*vals[1])) + (detJ*(K_10*vals[0] + K_11*vals[1]));
 
8991
      result = (detJ*(K[0]*vals[0] + K[1]*vals[1])) + (detJ*(K[2]*vals[0] + K[3]*vals[1]));
8854
8992
      return result;
8855
8993
        break;
8856
8994
      }
8857
8995
    case 1:
8858
8996
      {
8859
 
        y[0] = 0.5*x[1][0] + 0.5*x[2][0];
8860
 
      y[1] = 0.5*x[1][1] + 0.5*x[2][1];
 
8997
        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
8998
      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
8861
8999
      f.evaluate(vals, y, c);
8862
 
      result = (detJ*(K_00*vals[0] + K_01*vals[1])) + (detJ*(K_10*vals[0] + K_11*vals[1]));
 
9000
      result = (detJ*(K[0]*vals[0] + K[1]*vals[1])) + (detJ*(K[2]*vals[0] + K[3]*vals[1]));
8863
9001
      return result;
8864
9002
        break;
8865
9003
      }
8866
9004
    case 2:
8867
9005
      {
8868
 
        y[0] = 0.25*x[1][0] + 0.75*x[2][0];
8869
 
      y[1] = 0.25*x[1][1] + 0.75*x[2][1];
 
9006
        y[0] = 0.25*vertex_coordinates[2] + 0.75*vertex_coordinates[4];
 
9007
      y[1] = 0.25*vertex_coordinates[3] + 0.75*vertex_coordinates[5];
8870
9008
      f.evaluate(vals, y, c);
8871
 
      result = (detJ*(K_00*vals[0] + K_01*vals[1])) + (detJ*(K_10*vals[0] + K_11*vals[1]));
 
9009
      result = (detJ*(K[0]*vals[0] + K[1]*vals[1])) + (detJ*(K[2]*vals[0] + K[3]*vals[1]));
8872
9010
      return result;
8873
9011
        break;
8874
9012
      }
8875
9013
    case 3:
8876
9014
      {
8877
 
        y[0] = 0.75*x[0][0] + 0.25*x[2][0];
8878
 
      y[1] = 0.75*x[0][1] + 0.25*x[2][1];
 
9015
        y[0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[4];
 
9016
      y[1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[5];
8879
9017
      f.evaluate(vals, y, c);
8880
 
      result = (detJ*(K_00*vals[0] + K_01*vals[1]));
 
9018
      result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
8881
9019
      return result;
8882
9020
        break;
8883
9021
      }
8884
9022
    case 4:
8885
9023
      {
8886
 
        y[0] = 0.5*x[0][0] + 0.5*x[2][0];
8887
 
      y[1] = 0.5*x[0][1] + 0.5*x[2][1];
 
9024
        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
 
9025
      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
8888
9026
      f.evaluate(vals, y, c);
8889
 
      result = (detJ*(K_00*vals[0] + K_01*vals[1]));
 
9027
      result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
8890
9028
      return result;
8891
9029
        break;
8892
9030
      }
8893
9031
    case 5:
8894
9032
      {
8895
 
        y[0] = 0.25*x[0][0] + 0.75*x[2][0];
8896
 
      y[1] = 0.25*x[0][1] + 0.75*x[2][1];
 
9033
        y[0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[4];
 
9034
      y[1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[5];
8897
9035
      f.evaluate(vals, y, c);
8898
 
      result = (detJ*(K_00*vals[0] + K_01*vals[1]));
 
9036
      result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
8899
9037
      return result;
8900
9038
        break;
8901
9039
      }
8902
9040
    case 6:
8903
9041
      {
8904
 
        y[0] = 0.75*x[0][0] + 0.25*x[1][0];
8905
 
      y[1] = 0.75*x[0][1] + 0.25*x[1][1];
 
9042
        y[0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[2];
 
9043
      y[1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[3];
8906
9044
      f.evaluate(vals, y, c);
8907
 
      result = (-1.0)*(detJ*(K_10*vals[0] + K_11*vals[1]));
 
9045
      result = (-1.0)*(detJ*(K[2]*vals[0] + K[3]*vals[1]));
8908
9046
      return result;
8909
9047
        break;
8910
9048
      }
8911
9049
    case 7:
8912
9050
      {
8913
 
        y[0] = 0.5*x[0][0] + 0.5*x[1][0];
8914
 
      y[1] = 0.5*x[0][1] + 0.5*x[1][1];
 
9051
        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
 
9052
      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
8915
9053
      f.evaluate(vals, y, c);
8916
 
      result = (-1.0)*(detJ*(K_10*vals[0] + K_11*vals[1]));
 
9054
      result = (-1.0)*(detJ*(K[2]*vals[0] + K[3]*vals[1]));
8917
9055
      return result;
8918
9056
        break;
8919
9057
      }
8920
9058
    case 8:
8921
9059
      {
8922
 
        y[0] = 0.25*x[0][0] + 0.75*x[1][0];
8923
 
      y[1] = 0.25*x[0][1] + 0.75*x[1][1];
 
9060
        y[0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[2];
 
9061
      y[1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[3];
8924
9062
      f.evaluate(vals, y, c);
8925
 
      result = (-1.0)*(detJ*(K_10*vals[0] + K_11*vals[1]));
 
9063
      result = (-1.0)*(detJ*(K[2]*vals[0] + K[3]*vals[1]));
8926
9064
      return result;
8927
9065
        break;
8928
9066
      }
8929
9067
    case 9:
8930
9068
      {
8931
 
        y[0] = 0.5*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0];
8932
 
      y[1] = 0.5*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1];
 
9069
        y[0] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
9070
      y[1] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
8933
9071
      f.evaluate(vals, y, c);
8934
 
      result = (detJ*(K_00*vals[0] + K_01*vals[1]));
 
9072
      result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
8935
9073
      return result;
8936
9074
        break;
8937
9075
      }
8938
9076
    case 10:
8939
9077
      {
8940
 
        y[0] = 0.25*x[0][0] + 0.5*x[1][0] + 0.25*x[2][0];
8941
 
      y[1] = 0.25*x[0][1] + 0.5*x[1][1] + 0.25*x[2][1];
 
9078
        y[0] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
9079
      y[1] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
8942
9080
      f.evaluate(vals, y, c);
8943
 
      result = (detJ*(K_00*vals[0] + K_01*vals[1]));
 
9081
      result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
8944
9082
      return result;
8945
9083
        break;
8946
9084
      }
8947
9085
    case 11:
8948
9086
      {
8949
 
        y[0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.5*x[2][0];
8950
 
      y[1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.5*x[2][1];
 
9087
        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
9088
      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
8951
9089
      f.evaluate(vals, y, c);
8952
 
      result = (detJ*(K_00*vals[0] + K_01*vals[1]));
 
9090
      result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
8953
9091
      return result;
8954
9092
        break;
8955
9093
      }
8956
9094
    case 12:
8957
9095
      {
8958
 
        y[0] = 0.5*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0];
8959
 
      y[1] = 0.5*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1];
 
9096
        y[0] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
9097
      y[1] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
8960
9098
      f.evaluate(vals, y, c);
8961
 
      result = (detJ*(K_10*vals[0] + K_11*vals[1]));
 
9099
      result = (detJ*(K[2]*vals[0] + K[3]*vals[1]));
8962
9100
      return result;
8963
9101
        break;
8964
9102
      }
8965
9103
    case 13:
8966
9104
      {
8967
 
        y[0] = 0.25*x[0][0] + 0.5*x[1][0] + 0.25*x[2][0];
8968
 
      y[1] = 0.25*x[0][1] + 0.5*x[1][1] + 0.25*x[2][1];
 
9105
        y[0] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
9106
      y[1] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
8969
9107
      f.evaluate(vals, y, c);
8970
 
      result = (detJ*(K_10*vals[0] + K_11*vals[1]));
 
9108
      result = (detJ*(K[2]*vals[0] + K[3]*vals[1]));
8971
9109
      return result;
8972
9110
        break;
8973
9111
      }
8974
9112
    case 14:
8975
9113
      {
8976
 
        y[0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.5*x[2][0];
8977
 
      y[1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.5*x[2][1];
 
9114
        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
9115
      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
8978
9116
      f.evaluate(vals, y, c);
8979
 
      result = (detJ*(K_10*vals[0] + K_11*vals[1]));
 
9117
      result = (detJ*(K[2]*vals[0] + K[3]*vals[1]));
8980
9118
      return result;
8981
9119
        break;
8982
9120
      }
8988
9126
  /// Evaluate linear functionals for all dofs on the function f
8989
9127
  virtual void evaluate_dofs(double* values,
8990
9128
                             const ufc::function& f,
 
9129
                             const double* vertex_coordinates,
 
9130
                             int cell_orientation,
8991
9131
                             const ufc::cell& c) const
8992
9132
  {
8993
 
    // Declare variables for result of evaluation.
 
9133
    // Declare variables for result of evaluation
8994
9134
    double vals[2];
8995
9135
    
8996
 
    // Declare variable for physical coordinates.
 
9136
    // Declare variable for physical coordinates
8997
9137
    double y[2];
 
9138
    
8998
9139
    double result;
8999
 
    // Extract vertex coordinates
9000
 
    const double * const * x = c.coordinates;
9001
 
    
9002
 
    // Compute Jacobian of affine map from reference cell
9003
 
    const double J_00 = x[1][0] - x[0][0];
9004
 
    const double J_01 = x[2][0] - x[0][0];
9005
 
    const double J_10 = x[1][1] - x[0][1];
9006
 
    const double J_11 = x[2][1] - x[0][1];
9007
 
    
9008
 
    // Compute determinant of Jacobian
9009
 
    double detJ = J_00*J_11 - J_01*J_10;
9010
 
    
9011
 
    // Compute inverse of Jacobian
9012
 
    const double K_00 =  J_11 / detJ;
9013
 
    const double K_01 = -J_01 / detJ;
9014
 
    const double K_10 = -J_10 / detJ;
9015
 
    const double K_11 =  J_00 / detJ;y[0] = 0.75*x[1][0] + 0.25*x[2][0];
9016
 
    y[1] = 0.75*x[1][1] + 0.25*x[2][1];
 
9140
    // Compute Jacobian
 
9141
    double J[4];
 
9142
    compute_jacobian_triangle_2d(J, vertex_coordinates);
 
9143
    
 
9144
    
 
9145
    // Compute Jacobian inverse and determinant
 
9146
    double K[4];
 
9147
    double detJ;
 
9148
    compute_jacobian_inverse_triangle_2d(K, detJ, J);
 
9149
    
 
9150
    
 
9151
    y[0] = 0.75*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
9152
    y[1] = 0.75*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
9017
9153
    f.evaluate(vals, y, c);
9018
 
    result = (detJ*(K_00*vals[0] + K_01*vals[1])) + (detJ*(K_10*vals[0] + K_11*vals[1]));
 
9154
    result = (detJ*(K[0]*vals[0] + K[1]*vals[1])) + (detJ*(K[2]*vals[0] + K[3]*vals[1]));
9019
9155
    values[0] = result;
9020
 
    y[0] = 0.5*x[1][0] + 0.5*x[2][0];
9021
 
    y[1] = 0.5*x[1][1] + 0.5*x[2][1];
 
9156
    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
9157
    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
9022
9158
    f.evaluate(vals, y, c);
9023
 
    result = (detJ*(K_00*vals[0] + K_01*vals[1])) + (detJ*(K_10*vals[0] + K_11*vals[1]));
 
9159
    result = (detJ*(K[0]*vals[0] + K[1]*vals[1])) + (detJ*(K[2]*vals[0] + K[3]*vals[1]));
9024
9160
    values[1] = result;
9025
 
    y[0] = 0.25*x[1][0] + 0.75*x[2][0];
9026
 
    y[1] = 0.25*x[1][1] + 0.75*x[2][1];
 
9161
    y[0] = 0.25*vertex_coordinates[2] + 0.75*vertex_coordinates[4];
 
9162
    y[1] = 0.25*vertex_coordinates[3] + 0.75*vertex_coordinates[5];
9027
9163
    f.evaluate(vals, y, c);
9028
 
    result = (detJ*(K_00*vals[0] + K_01*vals[1])) + (detJ*(K_10*vals[0] + K_11*vals[1]));
 
9164
    result = (detJ*(K[0]*vals[0] + K[1]*vals[1])) + (detJ*(K[2]*vals[0] + K[3]*vals[1]));
9029
9165
    values[2] = result;
9030
 
    y[0] = 0.75*x[0][0] + 0.25*x[2][0];
9031
 
    y[1] = 0.75*x[0][1] + 0.25*x[2][1];
 
9166
    y[0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[4];
 
9167
    y[1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[5];
9032
9168
    f.evaluate(vals, y, c);
9033
 
    result = (detJ*(K_00*vals[0] + K_01*vals[1]));
 
9169
    result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
9034
9170
    values[3] = result;
9035
 
    y[0] = 0.5*x[0][0] + 0.5*x[2][0];
9036
 
    y[1] = 0.5*x[0][1] + 0.5*x[2][1];
 
9171
    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
 
9172
    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
9037
9173
    f.evaluate(vals, y, c);
9038
 
    result = (detJ*(K_00*vals[0] + K_01*vals[1]));
 
9174
    result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
9039
9175
    values[4] = result;
9040
 
    y[0] = 0.25*x[0][0] + 0.75*x[2][0];
9041
 
    y[1] = 0.25*x[0][1] + 0.75*x[2][1];
 
9176
    y[0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[4];
 
9177
    y[1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[5];
9042
9178
    f.evaluate(vals, y, c);
9043
 
    result = (detJ*(K_00*vals[0] + K_01*vals[1]));
 
9179
    result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
9044
9180
    values[5] = result;
9045
 
    y[0] = 0.75*x[0][0] + 0.25*x[1][0];
9046
 
    y[1] = 0.75*x[0][1] + 0.25*x[1][1];
 
9181
    y[0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[2];
 
9182
    y[1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[3];
9047
9183
    f.evaluate(vals, y, c);
9048
 
    result = (-1.0)*(detJ*(K_10*vals[0] + K_11*vals[1]));
 
9184
    result = (-1.0)*(detJ*(K[2]*vals[0] + K[3]*vals[1]));
9049
9185
    values[6] = result;
9050
 
    y[0] = 0.5*x[0][0] + 0.5*x[1][0];
9051
 
    y[1] = 0.5*x[0][1] + 0.5*x[1][1];
 
9186
    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
 
9187
    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
9052
9188
    f.evaluate(vals, y, c);
9053
 
    result = (-1.0)*(detJ*(K_10*vals[0] + K_11*vals[1]));
 
9189
    result = (-1.0)*(detJ*(K[2]*vals[0] + K[3]*vals[1]));
9054
9190
    values[7] = result;
9055
 
    y[0] = 0.25*x[0][0] + 0.75*x[1][0];
9056
 
    y[1] = 0.25*x[0][1] + 0.75*x[1][1];
 
9191
    y[0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[2];
 
9192
    y[1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[3];
9057
9193
    f.evaluate(vals, y, c);
9058
 
    result = (-1.0)*(detJ*(K_10*vals[0] + K_11*vals[1]));
 
9194
    result = (-1.0)*(detJ*(K[2]*vals[0] + K[3]*vals[1]));
9059
9195
    values[8] = result;
9060
 
    y[0] = 0.5*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0];
9061
 
    y[1] = 0.5*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1];
 
9196
    y[0] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
9197
    y[1] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
9062
9198
    f.evaluate(vals, y, c);
9063
 
    result = (detJ*(K_00*vals[0] + K_01*vals[1]));
 
9199
    result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
9064
9200
    values[9] = result;
9065
 
    y[0] = 0.25*x[0][0] + 0.5*x[1][0] + 0.25*x[2][0];
9066
 
    y[1] = 0.25*x[0][1] + 0.5*x[1][1] + 0.25*x[2][1];
 
9201
    y[0] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
9202
    y[1] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
9067
9203
    f.evaluate(vals, y, c);
9068
 
    result = (detJ*(K_00*vals[0] + K_01*vals[1]));
 
9204
    result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
9069
9205
    values[10] = result;
9070
 
    y[0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.5*x[2][0];
9071
 
    y[1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.5*x[2][1];
 
9206
    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
9207
    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
9072
9208
    f.evaluate(vals, y, c);
9073
 
    result = (detJ*(K_00*vals[0] + K_01*vals[1]));
 
9209
    result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
9074
9210
    values[11] = result;
9075
 
    y[0] = 0.5*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0];
9076
 
    y[1] = 0.5*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1];
 
9211
    y[0] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
9212
    y[1] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
9077
9213
    f.evaluate(vals, y, c);
9078
 
    result = (detJ*(K_10*vals[0] + K_11*vals[1]));
 
9214
    result = (detJ*(K[2]*vals[0] + K[3]*vals[1]));
9079
9215
    values[12] = result;
9080
 
    y[0] = 0.25*x[0][0] + 0.5*x[1][0] + 0.25*x[2][0];
9081
 
    y[1] = 0.25*x[0][1] + 0.5*x[1][1] + 0.25*x[2][1];
 
9216
    y[0] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
9217
    y[1] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
9082
9218
    f.evaluate(vals, y, c);
9083
 
    result = (detJ*(K_10*vals[0] + K_11*vals[1]));
 
9219
    result = (detJ*(K[2]*vals[0] + K[3]*vals[1]));
9084
9220
    values[13] = result;
9085
 
    y[0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.5*x[2][0];
9086
 
    y[1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.5*x[2][1];
 
9221
    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
9222
    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
9087
9223
    f.evaluate(vals, y, c);
9088
 
    result = (detJ*(K_10*vals[0] + K_11*vals[1]));
 
9224
    result = (detJ*(K[2]*vals[0] + K[3]*vals[1]));
9089
9225
    values[14] = result;
9090
9226
  }
9091
9227
 
9092
9228
  /// Interpolate vertex values from dof values
9093
9229
  virtual void interpolate_vertex_values(double* vertex_values,
9094
9230
                                         const double* dof_values,
 
9231
                                         const double* vertex_coordinates,
 
9232
                                         int cell_orientation,
9095
9233
                                         const ufc::cell& c) const
9096
9234
  {
9097
 
    // Extract vertex coordinates
9098
 
    const double * const * x = c.coordinates;
9099
 
    
9100
 
    // Compute Jacobian of affine map from reference cell
9101
 
    const double J_00 = x[1][0] - x[0][0];
9102
 
    const double J_01 = x[2][0] - x[0][0];
9103
 
    const double J_10 = x[1][1] - x[0][1];
9104
 
    const double J_11 = x[2][1] - x[0][1];
9105
 
    
9106
 
    // Compute determinant of Jacobian
9107
 
    double detJ = J_00*J_11 - J_01*J_10;
9108
 
    
9109
 
    // Compute inverse of Jacobian
 
9235
    // Compute Jacobian
 
9236
    double J[4];
 
9237
    compute_jacobian_triangle_2d(J, vertex_coordinates);
 
9238
    
 
9239
    
 
9240
    // Compute Jacobian inverse and determinant
 
9241
    double K[4];
 
9242
    double detJ;
 
9243
    compute_jacobian_inverse_triangle_2d(K, detJ, J);
 
9244
    
 
9245
    
 
9246
    
9110
9247
    // Evaluate function and change variables
9111
 
    vertex_values[0] = dof_values[3]*(1.0/detJ)*J_00*3.0 + dof_values[4]*((1.0/detJ)*(J_00*(-3.0))) + dof_values[5]*(1.0/detJ)*J_00 + dof_values[6]*((1.0/detJ)*(J_01*(-3.0))) + dof_values[7]*(1.0/detJ)*J_01*3.0 + dof_values[8]*((1.0/detJ)*(J_01*(-1.0)));
9112
 
    vertex_values[2] = dof_values[0]*(1.0/detJ)*J_00*3.0 + dof_values[1]*((1.0/detJ)*(J_00*(-3.0))) + dof_values[2]*(1.0/detJ)*J_00 + dof_values[6]*((1.0/detJ)*(J_00 + J_01*(-1.0))) + dof_values[7]*((1.0/detJ)*(J_00*(-3.0) + J_01*3.0)) + dof_values[8]*((1.0/detJ)*(J_00*3.0 + J_01*(-3.0)));
9113
 
    vertex_values[4] = dof_values[0]*(1.0/detJ)*J_01 + dof_values[1]*((1.0/detJ)*(J_01*(-3.0))) + dof_values[2]*(1.0/detJ)*J_01*3.0 + dof_values[3]*((1.0/detJ)*(J_00 + J_01*(-1.0))) + dof_values[4]*((1.0/detJ)*(J_00*(-3.0) + J_01*3.0)) + dof_values[5]*((1.0/detJ)*(J_00*3.0 + J_01*(-3.0)));
9114
 
    vertex_values[1] = dof_values[3]*(1.0/detJ)*J_10*3.0 + dof_values[4]*((1.0/detJ)*(J_10*(-3.0))) + dof_values[5]*(1.0/detJ)*J_10 + dof_values[6]*((1.0/detJ)*(J_11*(-3.0))) + dof_values[7]*(1.0/detJ)*J_11*3.0 + dof_values[8]*((1.0/detJ)*(J_11*(-1.0)));
9115
 
    vertex_values[3] = dof_values[0]*(1.0/detJ)*J_10*3.0 + dof_values[1]*((1.0/detJ)*(J_10*(-3.0))) + dof_values[2]*(1.0/detJ)*J_10 + dof_values[6]*((1.0/detJ)*(J_10 + J_11*(-1.0))) + dof_values[7]*((1.0/detJ)*(J_10*(-3.0) + J_11*3.0)) + dof_values[8]*((1.0/detJ)*(J_10*3.0 + J_11*(-3.0)));
9116
 
    vertex_values[5] = dof_values[0]*(1.0/detJ)*J_11 + dof_values[1]*((1.0/detJ)*(J_11*(-3.0))) + dof_values[2]*(1.0/detJ)*J_11*3.0 + dof_values[3]*((1.0/detJ)*(J_10 + J_11*(-1.0))) + dof_values[4]*((1.0/detJ)*(J_10*(-3.0) + J_11*3.0)) + dof_values[5]*((1.0/detJ)*(J_10*3.0 + J_11*(-3.0)));
 
9248
    vertex_values[0] = dof_values[3]*(1.0/detJ)*J[0]*3.0 + dof_values[4]*((1.0/detJ)*(J[0]*(-3.0))) + dof_values[5]*(1.0/detJ)*J[0] + dof_values[6]*((1.0/detJ)*(J[1]*(-3.0))) + dof_values[7]*(1.0/detJ)*J[1]*3.0 + dof_values[8]*((1.0/detJ)*(J[1]*(-1.0)));
 
9249
    vertex_values[2] = dof_values[0]*(1.0/detJ)*J[0]*3.0 + dof_values[1]*((1.0/detJ)*(J[0]*(-3.0))) + dof_values[2]*(1.0/detJ)*J[0] + dof_values[6]*((1.0/detJ)*(J[0] + J[1]*(-1.0))) + dof_values[7]*((1.0/detJ)*(J[0]*(-3.0) + J[1]*3.0)) + dof_values[8]*((1.0/detJ)*(J[0]*3.0 + J[1]*(-3.0)));
 
9250
    vertex_values[4] = dof_values[0]*(1.0/detJ)*J[1] + dof_values[1]*((1.0/detJ)*(J[1]*(-3.0))) + dof_values[2]*(1.0/detJ)*J[1]*3.0 + dof_values[3]*((1.0/detJ)*(J[0] + J[1]*(-1.0))) + dof_values[4]*((1.0/detJ)*(J[0]*(-3.0) + J[1]*3.0)) + dof_values[5]*((1.0/detJ)*(J[0]*3.0 + J[1]*(-3.0)));
 
9251
    vertex_values[1] = dof_values[3]*(1.0/detJ)*J[2]*3.0 + dof_values[4]*((1.0/detJ)*(J[2]*(-3.0))) + dof_values[5]*(1.0/detJ)*J[2] + dof_values[6]*((1.0/detJ)*(J[3]*(-3.0))) + dof_values[7]*(1.0/detJ)*J[3]*3.0 + dof_values[8]*((1.0/detJ)*(J[3]*(-1.0)));
 
9252
    vertex_values[3] = dof_values[0]*(1.0/detJ)*J[2]*3.0 + dof_values[1]*((1.0/detJ)*(J[2]*(-3.0))) + dof_values[2]*(1.0/detJ)*J[2] + dof_values[6]*((1.0/detJ)*(J[2] + J[3]*(-1.0))) + dof_values[7]*((1.0/detJ)*(J[2]*(-3.0) + J[3]*3.0)) + dof_values[8]*((1.0/detJ)*(J[2]*3.0 + J[3]*(-3.0)));
 
9253
    vertex_values[5] = dof_values[0]*(1.0/detJ)*J[3] + dof_values[1]*((1.0/detJ)*(J[3]*(-3.0))) + dof_values[2]*(1.0/detJ)*J[3]*3.0 + dof_values[3]*((1.0/detJ)*(J[2] + J[3]*(-1.0))) + dof_values[4]*((1.0/detJ)*(J[2]*(-3.0) + J[3]*3.0)) + dof_values[5]*((1.0/detJ)*(J[2]*3.0 + J[3]*(-3.0)));
9117
9254
  }
9118
9255
 
9119
9256
  /// Map coordinate xhat from reference cell to coordinate x in cell
9121
9258
                                       const double* xhat,
9122
9259
                                       const ufc::cell& c) const
9123
9260
  {
9124
 
    std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented (introduced in UFC 2.0)." << std::endl;
 
9261
    std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented." << std::endl;
9125
9262
  }
9126
9263
 
9127
9264
  /// Map from coordinate x in cell to coordinate xhat in reference cell
9129
9266
                                     const double* x,
9130
9267
                                     const ufc::cell& c) const
9131
9268
  {
9132
 
    std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented (introduced in UFC 2.0)." << std::endl;
 
9269
    std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented." << std::endl;
9133
9270
  }
9134
9271
 
9135
9272
  /// Return the number of sub elements (for a mixed element)
9136
 
  virtual unsigned int num_sub_elements() const
 
9273
  virtual std::size_t num_sub_elements() const
9137
9274
  {
9138
9275
    return 0;
9139
9276
  }
9140
9277
 
9141
9278
  /// Create a new finite element for sub element i (for a mixed element)
9142
 
  virtual ufc::finite_element* create_sub_element(unsigned int i) const
 
9279
  virtual ufc::finite_element* create_sub_element(std::size_t i) const
9143
9280
  {
9144
9281
    return 0;
9145
9282
  }
9173
9310
  /// Return a string identifying the finite element
9174
9311
  virtual const char* signature() const
9175
9312
  {
9176
 
    return "MixedElement(*[MixedElement(*[VectorElement('Discontinuous Lagrange', Cell('triangle', Space(2)), 0, 2, None), FiniteElement('Lagrange', Cell('triangle', Space(2)), 2, None)], **{'value_shape': (3,) }), FiniteElement('Raviart-Thomas', Cell('triangle', Space(2)), 3, None)], **{'value_shape': (5,) })";
 
9313
    return "MixedElement(*[MixedElement(*[VectorElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 0, 2, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 2, None)], **{'value_shape': (3,) }), FiniteElement('Raviart-Thomas', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 3, None)], **{'value_shape': (5,) })";
9177
9314
  }
9178
9315
 
9179
9316
  /// Return the cell shape
9183
9320
  }
9184
9321
 
9185
9322
  /// Return the topological dimension of the cell shape
9186
 
  virtual unsigned int topological_dimension() const
 
9323
  virtual std::size_t topological_dimension() const
9187
9324
  {
9188
9325
    return 2;
9189
9326
  }
9190
9327
 
9191
9328
  /// Return the geometric dimension of the cell shape
9192
 
  virtual unsigned int geometric_dimension() const
 
9329
  virtual std::size_t geometric_dimension() const
9193
9330
  {
9194
9331
    return 2;
9195
9332
  }
9196
9333
 
9197
9334
  /// Return the dimension of the finite element function space
9198
 
  virtual unsigned int space_dimension() const
 
9335
  virtual std::size_t space_dimension() const
9199
9336
  {
9200
9337
    return 23;
9201
9338
  }
9202
9339
 
9203
9340
  /// Return the rank of the value space
9204
 
  virtual unsigned int value_rank() const
 
9341
  virtual std::size_t value_rank() const
9205
9342
  {
9206
9343
    return 1;
9207
9344
  }
9208
9345
 
9209
9346
  /// Return the dimension of the value space for axis i
9210
 
  virtual unsigned int value_dimension(unsigned int i) const
 
9347
  virtual std::size_t value_dimension(std::size_t i) const
9211
9348
  {
9212
9349
    switch (i)
9213
9350
    {
9221
9358
    return 0;
9222
9359
  }
9223
9360
 
9224
 
  /// Evaluate basis function i at given point in cell
9225
 
  virtual void evaluate_basis(unsigned int i,
 
9361
  /// Evaluate basis function i at given point x in cell
 
9362
  virtual void evaluate_basis(std::size_t i,
9226
9363
                              double* values,
9227
 
                              const double* coordinates,
9228
 
                              const ufc::cell& c) const
 
9364
                              const double* x,
 
9365
                              const double* vertex_coordinates,
 
9366
                              int cell_orientation) const
9229
9367
  {
9230
 
    // Extract vertex coordinates
9231
 
    const double * const * x = c.coordinates;
9232
 
    
9233
 
    // Compute Jacobian of affine map from reference cell
9234
 
    const double J_00 = x[1][0] - x[0][0];
9235
 
    const double J_01 = x[2][0] - x[0][0];
9236
 
    const double J_10 = x[1][1] - x[0][1];
9237
 
    const double J_11 = x[2][1] - x[0][1];
9238
 
    
9239
 
    // Compute determinant of Jacobian
9240
 
    double detJ = J_00*J_11 - J_01*J_10;
9241
 
    
9242
 
    // Compute inverse of Jacobian
 
9368
    // Compute Jacobian
 
9369
    double J[4];
 
9370
    compute_jacobian_triangle_2d(J, vertex_coordinates);
 
9371
    
 
9372
    // Compute Jacobian inverse and determinant
 
9373
    double K[4];
 
9374
    double detJ;
 
9375
    compute_jacobian_inverse_triangle_2d(K, detJ, J);
 
9376
    
 
9377
    
9243
9378
    
9244
9379
    // Compute constants
9245
 
    const double C0 = x[1][0] + x[2][0];
9246
 
    const double C1 = x[1][1] + x[2][1];
 
9380
    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
 
9381
    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
9247
9382
    
9248
9383
    // Get coordinates and map to the reference (FIAT) element
9249
 
    double X = (J_01*(C1 - 2.0*coordinates[1]) + J_11*(2.0*coordinates[0] - C0)) / detJ;
9250
 
    double Y = (J_00*(2.0*coordinates[1] - C1) + J_10*(C0 - 2.0*coordinates[0])) / detJ;
 
9384
    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
 
9385
    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
9251
9386
    
9252
 
    // Reset values.
 
9387
    // Reset values
9253
9388
    values[0] = 0.0;
9254
9389
    values[1] = 0.0;
9255
9390
    values[2] = 0.0;
9260
9395
    case 0:
9261
9396
      {
9262
9397
        
9263
 
      // Array of basisvalues.
 
9398
      // Array of basisvalues
9264
9399
      double basisvalues[1] = {0.0};
9265
9400
      
9266
 
      // Declare helper variables.
 
9401
      // Declare helper variables
9267
9402
      
9268
 
      // Compute basisvalues.
 
9403
      // Compute basisvalues
9269
9404
      basisvalues[0] = 1.0;
9270
9405
      
9271
 
      // Table(s) of coefficients.
 
9406
      // Table(s) of coefficients
9272
9407
      static const double coefficients0[1] = \
9273
9408
      {1.0};
9274
9409
      
9275
 
      // Compute value(s).
 
9410
      // Compute value(s)
9276
9411
      for (unsigned int r = 0; r < 1; r++)
9277
9412
      {
9278
9413
        values[0] += coefficients0[r]*basisvalues[r];
9282
9417
    case 1:
9283
9418
      {
9284
9419
        
9285
 
      // Array of basisvalues.
 
9420
      // Array of basisvalues
9286
9421
      double basisvalues[1] = {0.0};
9287
9422
      
9288
 
      // Declare helper variables.
 
9423
      // Declare helper variables
9289
9424
      
9290
 
      // Compute basisvalues.
 
9425
      // Compute basisvalues
9291
9426
      basisvalues[0] = 1.0;
9292
9427
      
9293
 
      // Table(s) of coefficients.
 
9428
      // Table(s) of coefficients
9294
9429
      static const double coefficients0[1] = \
9295
9430
      {1.0};
9296
9431
      
9297
 
      // Compute value(s).
 
9432
      // Compute value(s)
9298
9433
      for (unsigned int r = 0; r < 1; r++)
9299
9434
      {
9300
9435
        values[1] += coefficients0[r]*basisvalues[r];
9304
9439
    case 2:
9305
9440
      {
9306
9441
        
9307
 
      // Array of basisvalues.
 
9442
      // Array of basisvalues
9308
9443
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
9309
9444
      
9310
 
      // Declare helper variables.
 
9445
      // Declare helper variables
9311
9446
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
9312
9447
      double tmp1 = (1.0 - Y)/2.0;
9313
9448
      double tmp2 = tmp1*tmp1;
9314
9449
      
9315
 
      // Compute basisvalues.
 
9450
      // Compute basisvalues
9316
9451
      basisvalues[0] = 1.0;
9317
9452
      basisvalues[1] = tmp0;
9318
9453
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
9326
9461
      basisvalues[4] *= std::sqrt(4.5);
9327
9462
      basisvalues[3] *= std::sqrt(7.5);
9328
9463
      
9329
 
      // Table(s) of coefficients.
 
9464
      // Table(s) of coefficients
9330
9465
      static const double coefficients0[6] = \
9331
9466
      {0.0, -0.17320508, -0.1, 0.12171612, 0.094280904, 0.054433105};
9332
9467
      
9333
 
      // Compute value(s).
 
9468
      // Compute value(s)
9334
9469
      for (unsigned int r = 0; r < 6; r++)
9335
9470
      {
9336
9471
        values[2] += coefficients0[r]*basisvalues[r];
9340
9475
    case 3:
9341
9476
      {
9342
9477
        
9343
 
      // Array of basisvalues.
 
9478
      // Array of basisvalues
9344
9479
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
9345
9480
      
9346
 
      // Declare helper variables.
 
9481
      // Declare helper variables
9347
9482
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
9348
9483
      double tmp1 = (1.0 - Y)/2.0;
9349
9484
      double tmp2 = tmp1*tmp1;
9350
9485
      
9351
 
      // Compute basisvalues.
 
9486
      // Compute basisvalues
9352
9487
      basisvalues[0] = 1.0;
9353
9488
      basisvalues[1] = tmp0;
9354
9489
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
9362
9497
      basisvalues[4] *= std::sqrt(4.5);
9363
9498
      basisvalues[3] *= std::sqrt(7.5);
9364
9499
      
9365
 
      // Table(s) of coefficients.
 
9500
      // Table(s) of coefficients
9366
9501
      static const double coefficients0[6] = \
9367
9502
      {0.0, 0.17320508, -0.1, 0.12171612, -0.094280904, 0.054433105};
9368
9503
      
9369
 
      // Compute value(s).
 
9504
      // Compute value(s)
9370
9505
      for (unsigned int r = 0; r < 6; r++)
9371
9506
      {
9372
9507
        values[2] += coefficients0[r]*basisvalues[r];
9376
9511
    case 4:
9377
9512
      {
9378
9513
        
9379
 
      // Array of basisvalues.
 
9514
      // Array of basisvalues
9380
9515
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
9381
9516
      
9382
 
      // Declare helper variables.
 
9517
      // Declare helper variables
9383
9518
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
9384
9519
      double tmp1 = (1.0 - Y)/2.0;
9385
9520
      double tmp2 = tmp1*tmp1;
9386
9521
      
9387
 
      // Compute basisvalues.
 
9522
      // Compute basisvalues
9388
9523
      basisvalues[0] = 1.0;
9389
9524
      basisvalues[1] = tmp0;
9390
9525
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
9398
9533
      basisvalues[4] *= std::sqrt(4.5);
9399
9534
      basisvalues[3] *= std::sqrt(7.5);
9400
9535
      
9401
 
      // Table(s) of coefficients.
 
9536
      // Table(s) of coefficients
9402
9537
      static const double coefficients0[6] = \
9403
9538
      {0.0, 0.0, 0.2, 0.0, 0.0, 0.16329932};
9404
9539
      
9405
 
      // Compute value(s).
 
9540
      // Compute value(s)
9406
9541
      for (unsigned int r = 0; r < 6; r++)
9407
9542
      {
9408
9543
        values[2] += coefficients0[r]*basisvalues[r];
9412
9547
    case 5:
9413
9548
      {
9414
9549
        
9415
 
      // Array of basisvalues.
 
9550
      // Array of basisvalues
9416
9551
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
9417
9552
      
9418
 
      // Declare helper variables.
 
9553
      // Declare helper variables
9419
9554
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
9420
9555
      double tmp1 = (1.0 - Y)/2.0;
9421
9556
      double tmp2 = tmp1*tmp1;
9422
9557
      
9423
 
      // Compute basisvalues.
 
9558
      // Compute basisvalues
9424
9559
      basisvalues[0] = 1.0;
9425
9560
      basisvalues[1] = tmp0;
9426
9561
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
9434
9569
      basisvalues[4] *= std::sqrt(4.5);
9435
9570
      basisvalues[3] *= std::sqrt(7.5);
9436
9571
      
9437
 
      // Table(s) of coefficients.
 
9572
      // Table(s) of coefficients
9438
9573
      static const double coefficients0[6] = \
9439
9574
      {0.47140452, 0.23094011, 0.13333333, 0.0, 0.18856181, -0.16329932};
9440
9575
      
9441
 
      // Compute value(s).
 
9576
      // Compute value(s)
9442
9577
      for (unsigned int r = 0; r < 6; r++)
9443
9578
      {
9444
9579
        values[2] += coefficients0[r]*basisvalues[r];
9448
9583
    case 6:
9449
9584
      {
9450
9585
        
9451
 
      // Array of basisvalues.
 
9586
      // Array of basisvalues
9452
9587
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
9453
9588
      
9454
 
      // Declare helper variables.
 
9589
      // Declare helper variables
9455
9590
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
9456
9591
      double tmp1 = (1.0 - Y)/2.0;
9457
9592
      double tmp2 = tmp1*tmp1;
9458
9593
      
9459
 
      // Compute basisvalues.
 
9594
      // Compute basisvalues
9460
9595
      basisvalues[0] = 1.0;
9461
9596
      basisvalues[1] = tmp0;
9462
9597
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
9470
9605
      basisvalues[4] *= std::sqrt(4.5);
9471
9606
      basisvalues[3] *= std::sqrt(7.5);
9472
9607
      
9473
 
      // Table(s) of coefficients.
 
9608
      // Table(s) of coefficients
9474
9609
      static const double coefficients0[6] = \
9475
9610
      {0.47140452, -0.23094011, 0.13333333, 0.0, -0.18856181, -0.16329932};
9476
9611
      
9477
 
      // Compute value(s).
 
9612
      // Compute value(s)
9478
9613
      for (unsigned int r = 0; r < 6; r++)
9479
9614
      {
9480
9615
        values[2] += coefficients0[r]*basisvalues[r];
9484
9619
    case 7:
9485
9620
      {
9486
9621
        
9487
 
      // Array of basisvalues.
 
9622
      // Array of basisvalues
9488
9623
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
9489
9624
      
9490
 
      // Declare helper variables.
 
9625
      // Declare helper variables
9491
9626
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
9492
9627
      double tmp1 = (1.0 - Y)/2.0;
9493
9628
      double tmp2 = tmp1*tmp1;
9494
9629
      
9495
 
      // Compute basisvalues.
 
9630
      // Compute basisvalues
9496
9631
      basisvalues[0] = 1.0;
9497
9632
      basisvalues[1] = tmp0;
9498
9633
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
9506
9641
      basisvalues[4] *= std::sqrt(4.5);
9507
9642
      basisvalues[3] *= std::sqrt(7.5);
9508
9643
      
9509
 
      // Table(s) of coefficients.
 
9644
      // Table(s) of coefficients
9510
9645
      static const double coefficients0[6] = \
9511
9646
      {0.47140452, 0.0, -0.26666667, -0.24343225, 0.0, 0.054433105};
9512
9647
      
9513
 
      // Compute value(s).
 
9648
      // Compute value(s)
9514
9649
      for (unsigned int r = 0; r < 6; r++)
9515
9650
      {
9516
9651
        values[2] += coefficients0[r]*basisvalues[r];
9520
9655
    case 8:
9521
9656
      {
9522
9657
        
9523
 
      // Array of basisvalues.
 
9658
      // Array of basisvalues
9524
9659
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
9525
9660
      
9526
 
      // Declare helper variables.
 
9661
      // Declare helper variables
9527
9662
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
9528
9663
      double tmp1 = (1.0 - Y)/2.0;
9529
9664
      double tmp2 = tmp1*tmp1;
9530
9665
      
9531
 
      // Compute basisvalues.
 
9666
      // Compute basisvalues
9532
9667
      basisvalues[0] = 1.0;
9533
9668
      basisvalues[1] = tmp0;
9534
9669
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
9550
9685
      basisvalues[7] *= std::sqrt(10.0);
9551
9686
      basisvalues[6] *= std::sqrt(14.0);
9552
9687
      
9553
 
      // Table(s) of coefficients.
 
9688
      // Table(s) of coefficients
9554
9689
      static const double coefficients0[10] = \
9555
9690
      {0.18856181, 0.28867513, -0.16666667, 0.26082027, -0.20203051, 0.11664237, 0.1069045, -0.09035079, 0.069985421, -0.040406102};
9556
9691
      
9557
9692
      static const double coefficients1[10] = \
9558
9693
      {0.14142136, -0.038490018, 0.13333333, 0.069552071, -0.12121831, 0.089425816, 0.0, 0.06023386, -0.077761579, 0.053874802};
9559
9694
      
9560
 
      // Compute value(s).
 
9695
      // Compute value(s)
9561
9696
      for (unsigned int r = 0; r < 10; r++)
9562
9697
      {
9563
9698
        values[3] += coefficients0[r]*basisvalues[r];
9564
9699
        values[4] += coefficients1[r]*basisvalues[r];
9565
9700
      }// end loop over 'r'
9566
9701
      
9567
 
      // Using contravariant Piola transform to map values back to the physical element.
 
9702
      // Using contravariant Piola transform to map values back to the physical element
9568
9703
      const double tmp_ref0 = values[3];
9569
9704
      const double tmp_ref1 = values[4];
9570
 
      values[3] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
9571
 
      values[4] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
9705
      values[3] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
9706
      values[4] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
9572
9707
        break;
9573
9708
      }
9574
9709
    case 9:
9575
9710
      {
9576
9711
        
9577
 
      // Array of basisvalues.
 
9712
      // Array of basisvalues
9578
9713
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
9579
9714
      
9580
 
      // Declare helper variables.
 
9715
      // Declare helper variables
9581
9716
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
9582
9717
      double tmp1 = (1.0 - Y)/2.0;
9583
9718
      double tmp2 = tmp1*tmp1;
9584
9719
      
9585
 
      // Compute basisvalues.
 
9720
      // Compute basisvalues
9586
9721
      basisvalues[0] = 1.0;
9587
9722
      basisvalues[1] = tmp0;
9588
9723
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
9604
9739
      basisvalues[7] *= std::sqrt(10.0);
9605
9740
      basisvalues[6] *= std::sqrt(14.0);
9606
9741
      
9607
 
      // Table(s) of coefficients.
 
9742
      // Table(s) of coefficients
9608
9743
      static const double coefficients0[10] = \
9609
9744
      {-0.18856181, -0.25018512, 0.23333333, -0.10432811, 0.32324881, -0.25661321, 0.0, 0.12046772, -0.15552316, 0.1077496};
9610
9745
      
9611
9746
      static const double coefficients1[10] = \
9612
9747
      {-0.18856181, 0.076980036, -0.33333333, 0.0, 0.24243661, -0.34992711, 0.0, 0.0, 0.15552316, -0.16162441};
9613
9748
      
9614
 
      // Compute value(s).
 
9749
      // Compute value(s)
9615
9750
      for (unsigned int r = 0; r < 10; r++)
9616
9751
      {
9617
9752
        values[3] += coefficients0[r]*basisvalues[r];
9618
9753
        values[4] += coefficients1[r]*basisvalues[r];
9619
9754
      }// end loop over 'r'
9620
9755
      
9621
 
      // Using contravariant Piola transform to map values back to the physical element.
 
9756
      // Using contravariant Piola transform to map values back to the physical element
9622
9757
      const double tmp_ref0 = values[3];
9623
9758
      const double tmp_ref1 = values[4];
9624
 
      values[3] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
9625
 
      values[4] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
9759
      values[3] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
9760
      values[4] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
9626
9761
        break;
9627
9762
      }
9628
9763
    case 10:
9629
9764
      {
9630
9765
        
9631
 
      // Array of basisvalues.
 
9766
      // Array of basisvalues
9632
9767
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
9633
9768
      
9634
 
      // Declare helper variables.
 
9769
      // Declare helper variables
9635
9770
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
9636
9771
      double tmp1 = (1.0 - Y)/2.0;
9637
9772
      double tmp2 = tmp1*tmp1;
9638
9773
      
9639
 
      // Compute basisvalues.
 
9774
      // Compute basisvalues
9640
9775
      basisvalues[0] = 1.0;
9641
9776
      basisvalues[1] = tmp0;
9642
9777
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
9658
9793
      basisvalues[7] *= std::sqrt(10.0);
9659
9794
      basisvalues[6] *= std::sqrt(14.0);
9660
9795
      
9661
 
      // Table(s) of coefficients.
 
9796
      // Table(s) of coefficients
9662
9797
      static const double coefficients0[10] = \
9663
9798
      {0.14142136, 0.096225045, -0.1, 0.0, -0.067343503, 0.15163508, 0.0, 0.0, 0.077761579, -0.080812204};
9664
9799
      
9665
9800
      static const double coefficients1[10] = \
9666
9801
      {0.18856181, 0.0, 0.33333333, 0.0, 0.0, 0.34992711, 0.0, 0.0, 0.0, 0.16162441};
9667
9802
      
9668
 
      // Compute value(s).
 
9803
      // Compute value(s)
9669
9804
      for (unsigned int r = 0; r < 10; r++)
9670
9805
      {
9671
9806
        values[3] += coefficients0[r]*basisvalues[r];
9672
9807
        values[4] += coefficients1[r]*basisvalues[r];
9673
9808
      }// end loop over 'r'
9674
9809
      
9675
 
      // Using contravariant Piola transform to map values back to the physical element.
 
9810
      // Using contravariant Piola transform to map values back to the physical element
9676
9811
      const double tmp_ref0 = values[3];
9677
9812
      const double tmp_ref1 = values[4];
9678
 
      values[3] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
9679
 
      values[4] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
9813
      values[3] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
9814
      values[4] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
9680
9815
        break;
9681
9816
      }
9682
9817
    case 11:
9683
9818
      {
9684
9819
        
9685
 
      // Array of basisvalues.
 
9820
      // Array of basisvalues
9686
9821
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
9687
9822
      
9688
 
      // Declare helper variables.
 
9823
      // Declare helper variables
9689
9824
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
9690
9825
      double tmp1 = (1.0 - Y)/2.0;
9691
9826
      double tmp2 = tmp1*tmp1;
9692
9827
      
9693
 
      // Compute basisvalues.
 
9828
      // Compute basisvalues
9694
9829
      basisvalues[0] = 1.0;
9695
9830
      basisvalues[1] = tmp0;
9696
9831
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
9712
9847
      basisvalues[7] *= std::sqrt(10.0);
9713
9848
      basisvalues[6] *= std::sqrt(14.0);
9714
9849
      
9715
 
      // Table(s) of coefficients.
 
9850
      // Table(s) of coefficients
9716
9851
      static const double coefficients0[10] = \
9717
9852
      {0.32998316, -0.25018512, -0.033333333, 0.33037234, 0.32324881, 0.20606818, -0.1069045, -0.03011693, 0.0077761579, 0.013468701};
9718
9853
      
9719
9854
      static const double coefficients1[10] = \
9720
9855
      {-0.14142136, -0.038490018, -0.13333333, -0.069552071, -0.12121831, -0.089425816, 0.0, -0.06023386, -0.077761579, -0.053874802};
9721
9856
      
9722
 
      // Compute value(s).
 
9857
      // Compute value(s)
9723
9858
      for (unsigned int r = 0; r < 10; r++)
9724
9859
      {
9725
9860
        values[3] += coefficients0[r]*basisvalues[r];
9726
9861
        values[4] += coefficients1[r]*basisvalues[r];
9727
9862
      }// end loop over 'r'
9728
9863
      
9729
 
      // Using contravariant Piola transform to map values back to the physical element.
 
9864
      // Using contravariant Piola transform to map values back to the physical element
9730
9865
      const double tmp_ref0 = values[3];
9731
9866
      const double tmp_ref1 = values[4];
9732
 
      values[3] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
9733
 
      values[4] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
9867
      values[3] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
9868
      values[4] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
9734
9869
        break;
9735
9870
      }
9736
9871
    case 12:
9737
9872
      {
9738
9873
        
9739
 
      // Array of basisvalues.
 
9874
      // Array of basisvalues
9740
9875
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
9741
9876
      
9742
 
      // Declare helper variables.
 
9877
      // Declare helper variables
9743
9878
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
9744
9879
      double tmp1 = (1.0 - Y)/2.0;
9745
9880
      double tmp2 = tmp1*tmp1;
9746
9881
      
9747
 
      // Compute basisvalues.
 
9882
      // Compute basisvalues
9748
9883
      basisvalues[0] = 1.0;
9749
9884
      basisvalues[1] = tmp0;
9750
9885
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
9766
9901
      basisvalues[7] *= std::sqrt(10.0);
9767
9902
      basisvalues[6] *= std::sqrt(14.0);
9768
9903
      
9769
 
      // Table(s) of coefficients.
 
9904
      // Table(s) of coefficients
9770
9905
      static const double coefficients0[10] = \
9771
9906
      {-0.37712362, 0.17320508, -0.1, -0.10432811, -0.56568542, -0.60654032, 0.0, 0.12046772, 0.0, -0.053874802};
9772
9907
      
9773
9908
      static const double coefficients1[10] = \
9774
9909
      {0.18856181, 0.076980036, 0.33333333, 0.0, 0.24243661, 0.34992711, 0.0, 0.0, 0.15552316, 0.16162441};
9775
9910
      
9776
 
      // Compute value(s).
 
9911
      // Compute value(s)
9777
9912
      for (unsigned int r = 0; r < 10; r++)
9778
9913
      {
9779
9914
        values[3] += coefficients0[r]*basisvalues[r];
9780
9915
        values[4] += coefficients1[r]*basisvalues[r];
9781
9916
      }// end loop over 'r'
9782
9917
      
9783
 
      // Using contravariant Piola transform to map values back to the physical element.
 
9918
      // Using contravariant Piola transform to map values back to the physical element
9784
9919
      const double tmp_ref0 = values[3];
9785
9920
      const double tmp_ref1 = values[4];
9786
 
      values[3] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
9787
 
      values[4] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
9921
      values[3] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
9922
      values[4] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
9788
9923
        break;
9789
9924
      }
9790
9925
    case 13:
9791
9926
      {
9792
9927
        
9793
 
      // Array of basisvalues.
 
9928
      // Array of basisvalues
9794
9929
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
9795
9930
      
9796
 
      // Declare helper variables.
 
9931
      // Declare helper variables
9797
9932
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
9798
9933
      double tmp1 = (1.0 - Y)/2.0;
9799
9934
      double tmp2 = tmp1*tmp1;
9800
9935
      
9801
 
      // Compute basisvalues.
 
9936
      // Compute basisvalues
9802
9937
      basisvalues[0] = 1.0;
9803
9938
      basisvalues[1] = tmp0;
9804
9939
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
9820
9955
      basisvalues[7] *= std::sqrt(10.0);
9821
9956
      basisvalues[6] *= std::sqrt(14.0);
9822
9957
      
9823
 
      // Table(s) of coefficients.
 
9958
      // Table(s) of coefficients
9824
9959
      static const double coefficients0[10] = \
9825
9960
      {0.32998316, -0.096225045, 0.23333333, 0.0, 0.067343503, 0.50156219, 0.0, 0.0, -0.077761579, 0.080812204};
9826
9961
      
9827
9962
      static const double coefficients1[10] = \
9828
9963
      {-0.18856181, 0.0, -0.33333333, 0.0, 0.0, -0.34992711, 0.0, 0.0, 0.0, -0.16162441};
9829
9964
      
9830
 
      // Compute value(s).
 
9965
      // Compute value(s)
9831
9966
      for (unsigned int r = 0; r < 10; r++)
9832
9967
      {
9833
9968
        values[3] += coefficients0[r]*basisvalues[r];
9834
9969
        values[4] += coefficients1[r]*basisvalues[r];
9835
9970
      }// end loop over 'r'
9836
9971
      
9837
 
      // Using contravariant Piola transform to map values back to the physical element.
 
9972
      // Using contravariant Piola transform to map values back to the physical element
9838
9973
      const double tmp_ref0 = values[3];
9839
9974
      const double tmp_ref1 = values[4];
9840
 
      values[3] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
9841
 
      values[4] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
9975
      values[3] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
9976
      values[4] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
9842
9977
        break;
9843
9978
      }
9844
9979
    case 14:
9845
9980
      {
9846
9981
        
9847
 
      // Array of basisvalues.
 
9982
      // Array of basisvalues
9848
9983
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
9849
9984
      
9850
 
      // Declare helper variables.
 
9985
      // Declare helper variables
9851
9986
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
9852
9987
      double tmp1 = (1.0 - Y)/2.0;
9853
9988
      double tmp2 = tmp1*tmp1;
9854
9989
      
9855
 
      // Compute basisvalues.
 
9990
      // Compute basisvalues
9856
9991
      basisvalues[0] = 1.0;
9857
9992
      basisvalues[1] = tmp0;
9858
9993
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
9874
10009
      basisvalues[7] *= std::sqrt(10.0);
9875
10010
      basisvalues[6] *= std::sqrt(14.0);
9876
10011
      
9877
 
      // Table(s) of coefficients.
 
10012
      // Table(s) of coefficients
9878
10013
      static const double coefficients0[10] = \
9879
10014
      {0.14142136, 0.13471506, -0.033333333, 0.15649216, 0.053874802, 0.011664237, 0.1069045, 0.03011693, -0.0077761579, -0.013468701};
9880
10015
      
9881
10016
      static const double coefficients1[10] = \
9882
10017
      {-0.32998316, 0.15396007, 0.2, -0.41731242, -0.25590531, -0.12830661, 0.0, 0.06023386, 0.077761579, 0.053874802};
9883
10018
      
9884
 
      // Compute value(s).
 
10019
      // Compute value(s)
9885
10020
      for (unsigned int r = 0; r < 10; r++)
9886
10021
      {
9887
10022
        values[3] += coefficients0[r]*basisvalues[r];
9888
10023
        values[4] += coefficients1[r]*basisvalues[r];
9889
10024
      }// end loop over 'r'
9890
10025
      
9891
 
      // Using contravariant Piola transform to map values back to the physical element.
 
10026
      // Using contravariant Piola transform to map values back to the physical element
9892
10027
      const double tmp_ref0 = values[3];
9893
10028
      const double tmp_ref1 = values[4];
9894
 
      values[3] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
9895
 
      values[4] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
10029
      values[3] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
10030
      values[4] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
9896
10031
        break;
9897
10032
      }
9898
10033
    case 15:
9899
10034
      {
9900
10035
        
9901
 
      // Array of basisvalues.
 
10036
      // Array of basisvalues
9902
10037
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
9903
10038
      
9904
 
      // Declare helper variables.
 
10039
      // Declare helper variables
9905
10040
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
9906
10041
      double tmp1 = (1.0 - Y)/2.0;
9907
10042
      double tmp2 = tmp1*tmp1;
9908
10043
      
9909
 
      // Compute basisvalues.
 
10044
      // Compute basisvalues
9910
10045
      basisvalues[0] = 1.0;
9911
10046
      basisvalues[1] = tmp0;
9912
10047
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
9928
10063
      basisvalues[7] *= std::sqrt(10.0);
9929
10064
      basisvalues[6] *= std::sqrt(14.0);
9930
10065
      
9931
 
      // Table(s) of coefficients.
 
10066
      // Table(s) of coefficients
9932
10067
      static const double coefficients0[10] = \
9933
10068
      {-0.18856181, -0.32716515, 0.1, -0.41731242, 0.080812204, 0.023328474, -0.21380899, 0.06023386, 0.015552316, -0.026937401};
9934
10069
      
9935
10070
      static const double coefficients1[10] = \
9936
10071
      {0.37712362, 0.0, -0.2, 0.83462485, 0.0, -0.046656947, 0.0, -0.12046772, 0.0, 0.053874802};
9937
10072
      
9938
 
      // Compute value(s).
 
10073
      // Compute value(s)
9939
10074
      for (unsigned int r = 0; r < 10; r++)
9940
10075
      {
9941
10076
        values[3] += coefficients0[r]*basisvalues[r];
9942
10077
        values[4] += coefficients1[r]*basisvalues[r];
9943
10078
      }// end loop over 'r'
9944
10079
      
9945
 
      // Using contravariant Piola transform to map values back to the physical element.
 
10080
      // Using contravariant Piola transform to map values back to the physical element
9946
10081
      const double tmp_ref0 = values[3];
9947
10082
      const double tmp_ref1 = values[4];
9948
 
      values[3] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
9949
 
      values[4] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
10083
      values[3] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
10084
      values[4] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
9950
10085
        break;
9951
10086
      }
9952
10087
    case 16:
9953
10088
      {
9954
10089
        
9955
 
      // Array of basisvalues.
 
10090
      // Array of basisvalues
9956
10091
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
9957
10092
      
9958
 
      // Declare helper variables.
 
10093
      // Declare helper variables
9959
10094
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
9960
10095
      double tmp1 = (1.0 - Y)/2.0;
9961
10096
      double tmp2 = tmp1*tmp1;
9962
10097
      
9963
 
      // Compute basisvalues.
 
10098
      // Compute basisvalues
9964
10099
      basisvalues[0] = 1.0;
9965
10100
      basisvalues[1] = tmp0;
9966
10101
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
9982
10117
      basisvalues[7] *= std::sqrt(10.0);
9983
10118
      basisvalues[6] *= std::sqrt(14.0);
9984
10119
      
9985
 
      // Table(s) of coefficients.
 
10120
      // Table(s) of coefficients
9986
10121
      static const double coefficients0[10] = \
9987
10122
      {0.18856181, 0.28867513, -0.16666667, 0.26082027, -0.20203051, 0.11664237, 0.1069045, -0.09035079, 0.069985421, -0.040406102};
9988
10123
      
9989
10124
      static const double coefficients1[10] = \
9990
10125
      {-0.32998316, -0.15396007, 0.2, -0.41731242, 0.25590531, -0.12830661, 0.0, 0.06023386, -0.077761579, 0.053874802};
9991
10126
      
9992
 
      // Compute value(s).
 
10127
      // Compute value(s)
9993
10128
      for (unsigned int r = 0; r < 10; r++)
9994
10129
      {
9995
10130
        values[3] += coefficients0[r]*basisvalues[r];
9996
10131
        values[4] += coefficients1[r]*basisvalues[r];
9997
10132
      }// end loop over 'r'
9998
10133
      
9999
 
      // Using contravariant Piola transform to map values back to the physical element.
 
10134
      // Using contravariant Piola transform to map values back to the physical element
10000
10135
      const double tmp_ref0 = values[3];
10001
10136
      const double tmp_ref1 = values[4];
10002
 
      values[3] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
10003
 
      values[4] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
10137
      values[3] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
10138
      values[4] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
10004
10139
        break;
10005
10140
      }
10006
10141
    case 17:
10007
10142
      {
10008
10143
        
10009
 
      // Array of basisvalues.
 
10144
      // Array of basisvalues
10010
10145
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
10011
10146
      
10012
 
      // Declare helper variables.
 
10147
      // Declare helper variables
10013
10148
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
10014
10149
      double tmp1 = (1.0 - Y)/2.0;
10015
10150
      double tmp2 = tmp1*tmp1;
10016
10151
      
10017
 
      // Compute basisvalues.
 
10152
      // Compute basisvalues
10018
10153
      basisvalues[0] = 1.0;
10019
10154
      basisvalues[1] = tmp0;
10020
10155
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
10036
10171
      basisvalues[7] *= std::sqrt(10.0);
10037
10172
      basisvalues[6] *= std::sqrt(14.0);
10038
10173
      
10039
 
      // Table(s) of coefficients.
 
10174
      // Table(s) of coefficients
10040
10175
      static const double coefficients0[10] = \
10041
10176
      {0.32998316, -0.69282032, -0.53333333, -0.39992441, -0.026937401, 0.20606818, 0.32071349, -0.03011693, -0.023328474, 0.013468701};
10042
10177
      
10043
10178
      static const double coefficients1[10] = \
10044
10179
      {0.23570226, 0.038490018, 0.066666667, 0.20865621, 0.12121831, -0.081649658, 0.0, 0.18070158, 0.077761579, 0.0};
10045
10180
      
10046
 
      // Compute value(s).
 
10181
      // Compute value(s)
10047
10182
      for (unsigned int r = 0; r < 10; r++)
10048
10183
      {
10049
10184
        values[3] += coefficients0[r]*basisvalues[r];
10050
10185
        values[4] += coefficients1[r]*basisvalues[r];
10051
10186
      }// end loop over 'r'
10052
10187
      
10053
 
      // Using contravariant Piola transform to map values back to the physical element.
 
10188
      // Using contravariant Piola transform to map values back to the physical element
10054
10189
      const double tmp_ref0 = values[3];
10055
10190
      const double tmp_ref1 = values[4];
10056
 
      values[3] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
10057
 
      values[4] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
10191
      values[3] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
10192
      values[4] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
10058
10193
        break;
10059
10194
      }
10060
10195
    case 18:
10061
10196
      {
10062
10197
        
10063
 
      // Array of basisvalues.
 
10198
      // Array of basisvalues
10064
10199
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
10065
10200
      
10066
 
      // Declare helper variables.
 
10201
      // Declare helper variables
10067
10202
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
10068
10203
      double tmp1 = (1.0 - Y)/2.0;
10069
10204
      double tmp2 = tmp1*tmp1;
10070
10205
      
10071
 
      // Compute basisvalues.
 
10206
      // Compute basisvalues
10072
10207
      basisvalues[0] = 1.0;
10073
10208
      basisvalues[1] = tmp0;
10074
10209
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
10090
10225
      basisvalues[7] *= std::sqrt(10.0);
10091
10226
      basisvalues[6] *= std::sqrt(14.0);
10092
10227
      
10093
 
      // Table(s) of coefficients.
 
10228
      // Table(s) of coefficients
10094
10229
      static const double coefficients0[10] = \
10095
10230
      {0.56568542, 0.65433031, -0.46666667, -0.19126819, -0.094280904, 0.12441853, -0.32071349, 0.15058465, -0.054433105, 0.013468701};
10096
10231
      
10097
10232
      static const double coefficients1[10] = \
10098
10233
      {-0.23570226, 0.038490018, -0.066666667, -0.20865621, 0.12121831, 0.081649658, 0.0, -0.18070158, 0.077761579, 0.0};
10099
10234
      
10100
 
      // Compute value(s).
 
10235
      // Compute value(s)
10101
10236
      for (unsigned int r = 0; r < 10; r++)
10102
10237
      {
10103
10238
        values[3] += coefficients0[r]*basisvalues[r];
10104
10239
        values[4] += coefficients1[r]*basisvalues[r];
10105
10240
      }// end loop over 'r'
10106
10241
      
10107
 
      // Using contravariant Piola transform to map values back to the physical element.
 
10242
      // Using contravariant Piola transform to map values back to the physical element
10108
10243
      const double tmp_ref0 = values[3];
10109
10244
      const double tmp_ref1 = values[4];
10110
 
      values[3] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
10111
 
      values[4] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
10245
      values[3] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
10246
      values[4] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
10112
10247
        break;
10113
10248
      }
10114
10249
    case 19:
10115
10250
      {
10116
10251
        
10117
 
      // Array of basisvalues.
 
10252
      // Array of basisvalues
10118
10253
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
10119
10254
      
10120
 
      // Declare helper variables.
 
10255
      // Declare helper variables
10121
10256
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
10122
10257
      double tmp1 = (1.0 - Y)/2.0;
10123
10258
      double tmp2 = tmp1*tmp1;
10124
10259
      
10125
 
      // Compute basisvalues.
 
10260
      // Compute basisvalues
10126
10261
      basisvalues[0] = 1.0;
10127
10262
      basisvalues[1] = tmp0;
10128
10263
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
10144
10279
      basisvalues[7] *= std::sqrt(10.0);
10145
10280
      basisvalues[6] *= std::sqrt(14.0);
10146
10281
      
10147
 
      // Table(s) of coefficients.
 
10282
      // Table(s) of coefficients
10148
10283
      static const double coefficients0[10] = \
10149
10284
      {0.094280904, 0.076980036, 0.93333333, 0.20865621, 0.24243661, -0.443241, 0.0, -0.24093544, 0.15552316, -0.053874802};
10150
10285
      
10151
10286
      static const double coefficients1[10] = \
10152
10287
      {0.0, -0.15396007, 0.0, 0.0, -0.48487322, 0.0, 0.0, 0.0, -0.31104632, 0.0};
10153
10288
      
10154
 
      // Compute value(s).
 
10289
      // Compute value(s)
10155
10290
      for (unsigned int r = 0; r < 10; r++)
10156
10291
      {
10157
10292
        values[3] += coefficients0[r]*basisvalues[r];
10158
10293
        values[4] += coefficients1[r]*basisvalues[r];
10159
10294
      }// end loop over 'r'
10160
10295
      
10161
 
      // Using contravariant Piola transform to map values back to the physical element.
 
10296
      // Using contravariant Piola transform to map values back to the physical element
10162
10297
      const double tmp_ref0 = values[3];
10163
10298
      const double tmp_ref1 = values[4];
10164
 
      values[3] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
10165
 
      values[4] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
10299
      values[3] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
10300
      values[4] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
10166
10301
        break;
10167
10302
      }
10168
10303
    case 20:
10169
10304
      {
10170
10305
        
10171
 
      // Array of basisvalues.
 
10306
      // Array of basisvalues
10172
10307
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
10173
10308
      
10174
 
      // Declare helper variables.
 
10309
      // Declare helper variables
10175
10310
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
10176
10311
      double tmp1 = (1.0 - Y)/2.0;
10177
10312
      double tmp2 = tmp1*tmp1;
10178
10313
      
10179
 
      // Compute basisvalues.
 
10314
      // Compute basisvalues
10180
10315
      basisvalues[0] = 1.0;
10181
10316
      basisvalues[1] = tmp0;
10182
10317
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
10198
10333
      basisvalues[7] *= std::sqrt(10.0);
10199
10334
      basisvalues[6] *= std::sqrt(14.0);
10200
10335
      
10201
 
      // Table(s) of coefficients.
 
10336
      // Table(s) of coefficients
10202
10337
      static const double coefficients0[10] = \
10203
10338
      {0.23570226, 0.076980036, 0.0, 0.052164053, 0.24243661, 0.058321184, 0.1069045, 0.15058465, -0.0077761579, -0.067343503};
10204
10339
      
10205
10340
      static const double coefficients1[10] = \
10206
10341
      {0.32998316, -0.80829038, -0.33333333, 0.069552071, -0.39059232, -0.21384434, 0.0, 0.06023386, 0.23328474, 0.21549921};
10207
10342
      
10208
 
      // Compute value(s).
 
10343
      // Compute value(s)
10209
10344
      for (unsigned int r = 0; r < 10; r++)
10210
10345
      {
10211
10346
        values[3] += coefficients0[r]*basisvalues[r];
10212
10347
        values[4] += coefficients1[r]*basisvalues[r];
10213
10348
      }// end loop over 'r'
10214
10349
      
10215
 
      // Using contravariant Piola transform to map values back to the physical element.
 
10350
      // Using contravariant Piola transform to map values back to the physical element
10216
10351
      const double tmp_ref0 = values[3];
10217
10352
      const double tmp_ref1 = values[4];
10218
 
      values[3] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
10219
 
      values[4] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
10353
      values[3] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
10354
      values[4] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
10220
10355
        break;
10221
10356
      }
10222
10357
    case 21:
10223
10358
      {
10224
10359
        
10225
 
      // Array of basisvalues.
 
10360
      // Array of basisvalues
10226
10361
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
10227
10362
      
10228
 
      // Declare helper variables.
 
10363
      // Declare helper variables
10229
10364
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
10230
10365
      double tmp1 = (1.0 - Y)/2.0;
10231
10366
      double tmp2 = tmp1*tmp1;
10232
10367
      
10233
 
      // Compute basisvalues.
 
10368
      // Compute basisvalues
10234
10369
      basisvalues[0] = 1.0;
10235
10370
      basisvalues[1] = tmp0;
10236
10371
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
10252
10387
      basisvalues[7] *= std::sqrt(10.0);
10253
10388
      basisvalues[6] *= std::sqrt(14.0);
10254
10389
      
10255
 
      // Table(s) of coefficients.
 
10390
      // Table(s) of coefficients
10256
10391
      static const double coefficients0[10] = \
10257
10392
      {0.0, -0.076980036, -0.13333333, -0.31298432, -0.24243661, 0.27994168, -0.21380899, -0.06023386, 0.17107547, -0.13468701};
10258
10393
      
10259
10394
      static const double coefficients1[10] = \
10260
10395
      {0.094280904, 0.84678039, -0.4, -0.13910414, 0.51181062, -0.13219468, 0.0, -0.12046772, -0.15552316, 0.21549921};
10261
10396
      
10262
 
      // Compute value(s).
 
10397
      // Compute value(s)
10263
10398
      for (unsigned int r = 0; r < 10; r++)
10264
10399
      {
10265
10400
        values[3] += coefficients0[r]*basisvalues[r];
10266
10401
        values[4] += coefficients1[r]*basisvalues[r];
10267
10402
      }// end loop over 'r'
10268
10403
      
10269
 
      // Using contravariant Piola transform to map values back to the physical element.
 
10404
      // Using contravariant Piola transform to map values back to the physical element
10270
10405
      const double tmp_ref0 = values[3];
10271
10406
      const double tmp_ref1 = values[4];
10272
 
      values[3] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
10273
 
      values[4] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
10407
      values[3] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
10408
      values[4] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
10274
10409
        break;
10275
10410
      }
10276
10411
    case 22:
10277
10412
      {
10278
10413
        
10279
 
      // Array of basisvalues.
 
10414
      // Array of basisvalues
10280
10415
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
10281
10416
      
10282
 
      // Declare helper variables.
 
10417
      // Declare helper variables
10283
10418
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
10284
10419
      double tmp1 = (1.0 - Y)/2.0;
10285
10420
      double tmp2 = tmp1*tmp1;
10286
10421
      
10287
 
      // Compute basisvalues.
 
10422
      // Compute basisvalues
10288
10423
      basisvalues[0] = 1.0;
10289
10424
      basisvalues[1] = tmp0;
10290
10425
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
10306
10441
      basisvalues[7] *= std::sqrt(10.0);
10307
10442
      basisvalues[6] *= std::sqrt(14.0);
10308
10443
      
10309
 
      // Table(s) of coefficients.
 
10444
      // Table(s) of coefficients
10310
10445
      static const double coefficients0[10] = \
10311
10446
      {-0.23570226, -0.038490018, 0.066666667, 0.10432811, -0.12121831, -0.19829203, 0.0, -0.12046772, -0.077761579, 0.13468701};
10312
10447
      
10313
10448
      static const double coefficients1[10] = \
10314
10449
      {0.56568542, -0.076980036, 0.8, 0.0, -0.24243661, -0.046656947, 0.0, 0.0, -0.15552316, -0.32324881};
10315
10450
      
10316
 
      // Compute value(s).
 
10451
      // Compute value(s)
10317
10452
      for (unsigned int r = 0; r < 10; r++)
10318
10453
      {
10319
10454
        values[3] += coefficients0[r]*basisvalues[r];
10320
10455
        values[4] += coefficients1[r]*basisvalues[r];
10321
10456
      }// end loop over 'r'
10322
10457
      
10323
 
      // Using contravariant Piola transform to map values back to the physical element.
 
10458
      // Using contravariant Piola transform to map values back to the physical element
10324
10459
      const double tmp_ref0 = values[3];
10325
10460
      const double tmp_ref1 = values[4];
10326
 
      values[3] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
10327
 
      values[4] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
10461
      values[3] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
10462
      values[4] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
10328
10463
        break;
10329
10464
      }
10330
10465
    }
10331
10466
    
10332
10467
  }
10333
10468
 
10334
 
  /// Evaluate all basis functions at given point in cell
 
10469
  /// Evaluate all basis functions at given point x in cell
10335
10470
  virtual void evaluate_basis_all(double* values,
10336
 
                                  const double* coordinates,
10337
 
                                  const ufc::cell& c) const
 
10471
                                  const double* x,
 
10472
                                  const double* vertex_coordinates,
 
10473
                                  int cell_orientation) const
10338
10474
  {
10339
10475
    // Helper variable to hold values of a single dof.
10340
10476
    double dof_values[5] = {0.0, 0.0, 0.0, 0.0, 0.0};
10341
10477
    
10342
 
    // Loop dofs and call evaluate_basis.
 
10478
    // Loop dofs and call evaluate_basis
10343
10479
    for (unsigned int r = 0; r < 23; r++)
10344
10480
    {
10345
 
      evaluate_basis(r, dof_values, coordinates, c);
 
10481
      evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
10346
10482
      for (unsigned int s = 0; s < 5; s++)
10347
10483
      {
10348
10484
        values[r*5 + s] = dof_values[s];
10350
10486
    }// end loop over 'r'
10351
10487
  }
10352
10488
 
10353
 
  /// Evaluate order n derivatives of basis function i at given point in cell
10354
 
  virtual void evaluate_basis_derivatives(unsigned int i,
10355
 
                                          unsigned int n,
 
10489
  /// Evaluate order n derivatives of basis function i at given point x in cell
 
10490
  virtual void evaluate_basis_derivatives(std::size_t i,
 
10491
                                          std::size_t n,
10356
10492
                                          double* values,
10357
 
                                          const double* coordinates,
10358
 
                                          const ufc::cell& c) const
 
10493
                                          const double* x,
 
10494
                                          const double* vertex_coordinates,
 
10495
                                          int cell_orientation) const
10359
10496
  {
10360
 
    // Extract vertex coordinates
10361
 
    const double * const * x = c.coordinates;
10362
 
    
10363
 
    // Compute Jacobian of affine map from reference cell
10364
 
    const double J_00 = x[1][0] - x[0][0];
10365
 
    const double J_01 = x[2][0] - x[0][0];
10366
 
    const double J_10 = x[1][1] - x[0][1];
10367
 
    const double J_11 = x[2][1] - x[0][1];
10368
 
    
10369
 
    // Compute determinant of Jacobian
10370
 
    double detJ = J_00*J_11 - J_01*J_10;
10371
 
    
10372
 
    // Compute inverse of Jacobian
10373
 
    const double K_00 =  J_11 / detJ;
10374
 
    const double K_01 = -J_01 / detJ;
10375
 
    const double K_10 = -J_10 / detJ;
10376
 
    const double K_11 =  J_00 / detJ;
 
10497
    // Compute Jacobian
 
10498
    double J[4];
 
10499
    compute_jacobian_triangle_2d(J, vertex_coordinates);
 
10500
    
 
10501
    // Compute Jacobian inverse and determinant
 
10502
    double K[4];
 
10503
    double detJ;
 
10504
    compute_jacobian_inverse_triangle_2d(K, detJ, J);
 
10505
    
 
10506
    
10377
10507
    
10378
10508
    // Compute constants
10379
 
    const double C0 = x[1][0] + x[2][0];
10380
 
    const double C1 = x[1][1] + x[2][1];
 
10509
    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
 
10510
    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
10381
10511
    
10382
10512
    // Get coordinates and map to the reference (FIAT) element
10383
 
    double X = (J_01*(C1 - 2.0*coordinates[1]) + J_11*(2.0*coordinates[0] - C0)) / detJ;
10384
 
    double Y = (J_00*(2.0*coordinates[1] - C1) + J_10*(C0 - 2.0*coordinates[0])) / detJ;
 
10513
    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
 
10514
    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
10385
10515
    
10386
10516
    // Compute number of derivatives.
10387
10517
    unsigned int num_derivatives = 1;
10418
10548
    }
10419
10549
    
10420
10550
    // Compute inverse of Jacobian
10421
 
    const double Jinv[2][2] = {{K_00, K_01}, {K_10, K_11}};
 
10551
    const double Jinv[2][2] = {{K[0], K[1]}, {K[2], K[3]}};
10422
10552
    
10423
10553
    // Declare transformation matrix
10424
10554
    // Declare pointer to two dimensional array and initialise
10452
10582
    case 0:
10453
10583
      {
10454
10584
        
10455
 
      // Array of basisvalues.
 
10585
      // Array of basisvalues
10456
10586
      double basisvalues[1] = {0.0};
10457
10587
      
10458
 
      // Declare helper variables.
 
10588
      // Declare helper variables
10459
10589
      
10460
 
      // Compute basisvalues.
 
10590
      // Compute basisvalues
10461
10591
      basisvalues[0] = 1.0;
10462
10592
      
10463
 
      // Table(s) of coefficients.
 
10593
      // Table(s) of coefficients
10464
10594
      static const double coefficients0[1] = \
10465
10595
      {1.0};
10466
10596
      
10584
10714
    case 1:
10585
10715
      {
10586
10716
        
10587
 
      // Array of basisvalues.
 
10717
      // Array of basisvalues
10588
10718
      double basisvalues[1] = {0.0};
10589
10719
      
10590
 
      // Declare helper variables.
 
10720
      // Declare helper variables
10591
10721
      
10592
 
      // Compute basisvalues.
 
10722
      // Compute basisvalues
10593
10723
      basisvalues[0] = 1.0;
10594
10724
      
10595
 
      // Table(s) of coefficients.
 
10725
      // Table(s) of coefficients
10596
10726
      static const double coefficients0[1] = \
10597
10727
      {1.0};
10598
10728
      
10716
10846
    case 2:
10717
10847
      {
10718
10848
        
10719
 
      // Array of basisvalues.
 
10849
      // Array of basisvalues
10720
10850
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
10721
10851
      
10722
 
      // Declare helper variables.
 
10852
      // Declare helper variables
10723
10853
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
10724
10854
      double tmp1 = (1.0 - Y)/2.0;
10725
10855
      double tmp2 = tmp1*tmp1;
10726
10856
      
10727
 
      // Compute basisvalues.
 
10857
      // Compute basisvalues
10728
10858
      basisvalues[0] = 1.0;
10729
10859
      basisvalues[1] = tmp0;
10730
10860
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
10738
10868
      basisvalues[4] *= std::sqrt(4.5);
10739
10869
      basisvalues[3] *= std::sqrt(7.5);
10740
10870
      
10741
 
      // Table(s) of coefficients.
 
10871
      // Table(s) of coefficients
10742
10872
      static const double coefficients0[6] = \
10743
10873
      {0.0, -0.17320508, -0.1, 0.12171612, 0.094280904, 0.054433105};
10744
10874
      
10882
11012
    case 3:
10883
11013
      {
10884
11014
        
10885
 
      // Array of basisvalues.
 
11015
      // Array of basisvalues
10886
11016
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
10887
11017
      
10888
 
      // Declare helper variables.
 
11018
      // Declare helper variables
10889
11019
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
10890
11020
      double tmp1 = (1.0 - Y)/2.0;
10891
11021
      double tmp2 = tmp1*tmp1;
10892
11022
      
10893
 
      // Compute basisvalues.
 
11023
      // Compute basisvalues
10894
11024
      basisvalues[0] = 1.0;
10895
11025
      basisvalues[1] = tmp0;
10896
11026
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
10904
11034
      basisvalues[4] *= std::sqrt(4.5);
10905
11035
      basisvalues[3] *= std::sqrt(7.5);
10906
11036
      
10907
 
      // Table(s) of coefficients.
 
11037
      // Table(s) of coefficients
10908
11038
      static const double coefficients0[6] = \
10909
11039
      {0.0, 0.17320508, -0.1, 0.12171612, -0.094280904, 0.054433105};
10910
11040
      
11048
11178
    case 4:
11049
11179
      {
11050
11180
        
11051
 
      // Array of basisvalues.
 
11181
      // Array of basisvalues
11052
11182
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
11053
11183
      
11054
 
      // Declare helper variables.
 
11184
      // Declare helper variables
11055
11185
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
11056
11186
      double tmp1 = (1.0 - Y)/2.0;
11057
11187
      double tmp2 = tmp1*tmp1;
11058
11188
      
11059
 
      // Compute basisvalues.
 
11189
      // Compute basisvalues
11060
11190
      basisvalues[0] = 1.0;
11061
11191
      basisvalues[1] = tmp0;
11062
11192
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
11070
11200
      basisvalues[4] *= std::sqrt(4.5);
11071
11201
      basisvalues[3] *= std::sqrt(7.5);
11072
11202
      
11073
 
      // Table(s) of coefficients.
 
11203
      // Table(s) of coefficients
11074
11204
      static const double coefficients0[6] = \
11075
11205
      {0.0, 0.0, 0.2, 0.0, 0.0, 0.16329932};
11076
11206
      
11214
11344
    case 5:
11215
11345
      {
11216
11346
        
11217
 
      // Array of basisvalues.
 
11347
      // Array of basisvalues
11218
11348
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
11219
11349
      
11220
 
      // Declare helper variables.
 
11350
      // Declare helper variables
11221
11351
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
11222
11352
      double tmp1 = (1.0 - Y)/2.0;
11223
11353
      double tmp2 = tmp1*tmp1;
11224
11354
      
11225
 
      // Compute basisvalues.
 
11355
      // Compute basisvalues
11226
11356
      basisvalues[0] = 1.0;
11227
11357
      basisvalues[1] = tmp0;
11228
11358
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
11236
11366
      basisvalues[4] *= std::sqrt(4.5);
11237
11367
      basisvalues[3] *= std::sqrt(7.5);
11238
11368
      
11239
 
      // Table(s) of coefficients.
 
11369
      // Table(s) of coefficients
11240
11370
      static const double coefficients0[6] = \
11241
11371
      {0.47140452, 0.23094011, 0.13333333, 0.0, 0.18856181, -0.16329932};
11242
11372
      
11380
11510
    case 6:
11381
11511
      {
11382
11512
        
11383
 
      // Array of basisvalues.
 
11513
      // Array of basisvalues
11384
11514
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
11385
11515
      
11386
 
      // Declare helper variables.
 
11516
      // Declare helper variables
11387
11517
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
11388
11518
      double tmp1 = (1.0 - Y)/2.0;
11389
11519
      double tmp2 = tmp1*tmp1;
11390
11520
      
11391
 
      // Compute basisvalues.
 
11521
      // Compute basisvalues
11392
11522
      basisvalues[0] = 1.0;
11393
11523
      basisvalues[1] = tmp0;
11394
11524
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
11402
11532
      basisvalues[4] *= std::sqrt(4.5);
11403
11533
      basisvalues[3] *= std::sqrt(7.5);
11404
11534
      
11405
 
      // Table(s) of coefficients.
 
11535
      // Table(s) of coefficients
11406
11536
      static const double coefficients0[6] = \
11407
11537
      {0.47140452, -0.23094011, 0.13333333, 0.0, -0.18856181, -0.16329932};
11408
11538
      
11546
11676
    case 7:
11547
11677
      {
11548
11678
        
11549
 
      // Array of basisvalues.
 
11679
      // Array of basisvalues
11550
11680
      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
11551
11681
      
11552
 
      // Declare helper variables.
 
11682
      // Declare helper variables
11553
11683
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
11554
11684
      double tmp1 = (1.0 - Y)/2.0;
11555
11685
      double tmp2 = tmp1*tmp1;
11556
11686
      
11557
 
      // Compute basisvalues.
 
11687
      // Compute basisvalues
11558
11688
      basisvalues[0] = 1.0;
11559
11689
      basisvalues[1] = tmp0;
11560
11690
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
11568
11698
      basisvalues[4] *= std::sqrt(4.5);
11569
11699
      basisvalues[3] *= std::sqrt(7.5);
11570
11700
      
11571
 
      // Table(s) of coefficients.
 
11701
      // Table(s) of coefficients
11572
11702
      static const double coefficients0[6] = \
11573
11703
      {0.47140452, 0.0, -0.26666667, -0.24343225, 0.0, 0.054433105};
11574
11704
      
11712
11842
    case 8:
11713
11843
      {
11714
11844
        
11715
 
      // Array of basisvalues.
 
11845
      // Array of basisvalues
11716
11846
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
11717
11847
      
11718
 
      // Declare helper variables.
 
11848
      // Declare helper variables
11719
11849
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
11720
11850
      double tmp1 = (1.0 - Y)/2.0;
11721
11851
      double tmp2 = tmp1*tmp1;
11722
11852
      
11723
 
      // Compute basisvalues.
 
11853
      // Compute basisvalues
11724
11854
      basisvalues[0] = 1.0;
11725
11855
      basisvalues[1] = tmp0;
11726
11856
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
11742
11872
      basisvalues[7] *= std::sqrt(10.0);
11743
11873
      basisvalues[6] *= std::sqrt(14.0);
11744
11874
      
11745
 
      // Table(s) of coefficients.
 
11875
      // Table(s) of coefficients
11746
11876
      static const double coefficients0[10] = \
11747
11877
      {0.18856181, 0.28867513, -0.16666667, 0.26082027, -0.20203051, 0.11664237, 0.1069045, -0.09035079, 0.069985421, -0.040406102};
11748
11878
      
11782
11912
        derivatives[r] = 0.0;
11783
11913
      }// end loop over 'r'
11784
11914
      
 
11915
      // Declare pointer to array of reference derivatives on physical element.
 
11916
      double *derivatives_p = new double[2*num_derivatives];
 
11917
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
11918
      {
 
11919
        derivatives_p[r] = 0.0;
 
11920
      }// end loop over 'r'
 
11921
      
11785
11922
      // Declare derivative matrix (of polynomial basis).
11786
11923
      double dmats[10][10] = \
11787
11924
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
11880
12017
        // Using contravariant Piola transform to map values back to the physical element.
11881
12018
        const double tmp_ref0 = derivatives[r];
11882
12019
        const double tmp_ref1 = derivatives[num_derivatives + r];
11883
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
11884
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
12020
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
12021
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
11885
12022
      }// end loop over 'r'
11886
12023
      
11887
12024
      // Transform derivatives back to physical element
11889
12026
      {
11890
12027
        for (unsigned int s = 0; s < num_derivatives; s++)
11891
12028
        {
11892
 
          values[3*num_derivatives + r] += transform[r][s]*derivatives[s];
11893
 
          values[4*num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
12029
          values[3*num_derivatives + r] += transform[r][s]*derivatives_p[s];
 
12030
          values[4*num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
11894
12031
        }// end loop over 's'
11895
12032
      }// end loop over 'r'
11896
12033
      
11897
12034
      // Delete pointer to array of derivatives on FIAT element
11898
12035
      delete [] derivatives;
11899
12036
      
 
12037
      // Delete pointer to array of reference derivatives on physical element.
 
12038
      delete [] derivatives_p;
 
12039
      
11900
12040
      // Delete pointer to array of combinations of derivatives and transform
11901
12041
      for (unsigned int r = 0; r < num_derivatives; r++)
11902
12042
      {
11913
12053
    case 9:
11914
12054
      {
11915
12055
        
11916
 
      // Array of basisvalues.
 
12056
      // Array of basisvalues
11917
12057
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
11918
12058
      
11919
 
      // Declare helper variables.
 
12059
      // Declare helper variables
11920
12060
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
11921
12061
      double tmp1 = (1.0 - Y)/2.0;
11922
12062
      double tmp2 = tmp1*tmp1;
11923
12063
      
11924
 
      // Compute basisvalues.
 
12064
      // Compute basisvalues
11925
12065
      basisvalues[0] = 1.0;
11926
12066
      basisvalues[1] = tmp0;
11927
12067
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
11943
12083
      basisvalues[7] *= std::sqrt(10.0);
11944
12084
      basisvalues[6] *= std::sqrt(14.0);
11945
12085
      
11946
 
      // Table(s) of coefficients.
 
12086
      // Table(s) of coefficients
11947
12087
      static const double coefficients0[10] = \
11948
12088
      {-0.18856181, -0.25018512, 0.23333333, -0.10432811, 0.32324881, -0.25661321, 0.0, 0.12046772, -0.15552316, 0.1077496};
11949
12089
      
11983
12123
        derivatives[r] = 0.0;
11984
12124
      }// end loop over 'r'
11985
12125
      
 
12126
      // Declare pointer to array of reference derivatives on physical element.
 
12127
      double *derivatives_p = new double[2*num_derivatives];
 
12128
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
12129
      {
 
12130
        derivatives_p[r] = 0.0;
 
12131
      }// end loop over 'r'
 
12132
      
11986
12133
      // Declare derivative matrix (of polynomial basis).
11987
12134
      double dmats[10][10] = \
11988
12135
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
12081
12228
        // Using contravariant Piola transform to map values back to the physical element.
12082
12229
        const double tmp_ref0 = derivatives[r];
12083
12230
        const double tmp_ref1 = derivatives[num_derivatives + r];
12084
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
12085
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
12231
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
12232
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
12086
12233
      }// end loop over 'r'
12087
12234
      
12088
12235
      // Transform derivatives back to physical element
12090
12237
      {
12091
12238
        for (unsigned int s = 0; s < num_derivatives; s++)
12092
12239
        {
12093
 
          values[3*num_derivatives + r] += transform[r][s]*derivatives[s];
12094
 
          values[4*num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
12240
          values[3*num_derivatives + r] += transform[r][s]*derivatives_p[s];
 
12241
          values[4*num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
12095
12242
        }// end loop over 's'
12096
12243
      }// end loop over 'r'
12097
12244
      
12098
12245
      // Delete pointer to array of derivatives on FIAT element
12099
12246
      delete [] derivatives;
12100
12247
      
 
12248
      // Delete pointer to array of reference derivatives on physical element.
 
12249
      delete [] derivatives_p;
 
12250
      
12101
12251
      // Delete pointer to array of combinations of derivatives and transform
12102
12252
      for (unsigned int r = 0; r < num_derivatives; r++)
12103
12253
      {
12114
12264
    case 10:
12115
12265
      {
12116
12266
        
12117
 
      // Array of basisvalues.
 
12267
      // Array of basisvalues
12118
12268
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
12119
12269
      
12120
 
      // Declare helper variables.
 
12270
      // Declare helper variables
12121
12271
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
12122
12272
      double tmp1 = (1.0 - Y)/2.0;
12123
12273
      double tmp2 = tmp1*tmp1;
12124
12274
      
12125
 
      // Compute basisvalues.
 
12275
      // Compute basisvalues
12126
12276
      basisvalues[0] = 1.0;
12127
12277
      basisvalues[1] = tmp0;
12128
12278
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
12144
12294
      basisvalues[7] *= std::sqrt(10.0);
12145
12295
      basisvalues[6] *= std::sqrt(14.0);
12146
12296
      
12147
 
      // Table(s) of coefficients.
 
12297
      // Table(s) of coefficients
12148
12298
      static const double coefficients0[10] = \
12149
12299
      {0.14142136, 0.096225045, -0.1, 0.0, -0.067343503, 0.15163508, 0.0, 0.0, 0.077761579, -0.080812204};
12150
12300
      
12184
12334
        derivatives[r] = 0.0;
12185
12335
      }// end loop over 'r'
12186
12336
      
 
12337
      // Declare pointer to array of reference derivatives on physical element.
 
12338
      double *derivatives_p = new double[2*num_derivatives];
 
12339
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
12340
      {
 
12341
        derivatives_p[r] = 0.0;
 
12342
      }// end loop over 'r'
 
12343
      
12187
12344
      // Declare derivative matrix (of polynomial basis).
12188
12345
      double dmats[10][10] = \
12189
12346
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
12282
12439
        // Using contravariant Piola transform to map values back to the physical element.
12283
12440
        const double tmp_ref0 = derivatives[r];
12284
12441
        const double tmp_ref1 = derivatives[num_derivatives + r];
12285
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
12286
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
12442
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
12443
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
12287
12444
      }// end loop over 'r'
12288
12445
      
12289
12446
      // Transform derivatives back to physical element
12291
12448
      {
12292
12449
        for (unsigned int s = 0; s < num_derivatives; s++)
12293
12450
        {
12294
 
          values[3*num_derivatives + r] += transform[r][s]*derivatives[s];
12295
 
          values[4*num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
12451
          values[3*num_derivatives + r] += transform[r][s]*derivatives_p[s];
 
12452
          values[4*num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
12296
12453
        }// end loop over 's'
12297
12454
      }// end loop over 'r'
12298
12455
      
12299
12456
      // Delete pointer to array of derivatives on FIAT element
12300
12457
      delete [] derivatives;
12301
12458
      
 
12459
      // Delete pointer to array of reference derivatives on physical element.
 
12460
      delete [] derivatives_p;
 
12461
      
12302
12462
      // Delete pointer to array of combinations of derivatives and transform
12303
12463
      for (unsigned int r = 0; r < num_derivatives; r++)
12304
12464
      {
12315
12475
    case 11:
12316
12476
      {
12317
12477
        
12318
 
      // Array of basisvalues.
 
12478
      // Array of basisvalues
12319
12479
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
12320
12480
      
12321
 
      // Declare helper variables.
 
12481
      // Declare helper variables
12322
12482
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
12323
12483
      double tmp1 = (1.0 - Y)/2.0;
12324
12484
      double tmp2 = tmp1*tmp1;
12325
12485
      
12326
 
      // Compute basisvalues.
 
12486
      // Compute basisvalues
12327
12487
      basisvalues[0] = 1.0;
12328
12488
      basisvalues[1] = tmp0;
12329
12489
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
12345
12505
      basisvalues[7] *= std::sqrt(10.0);
12346
12506
      basisvalues[6] *= std::sqrt(14.0);
12347
12507
      
12348
 
      // Table(s) of coefficients.
 
12508
      // Table(s) of coefficients
12349
12509
      static const double coefficients0[10] = \
12350
12510
      {0.32998316, -0.25018512, -0.033333333, 0.33037234, 0.32324881, 0.20606818, -0.1069045, -0.03011693, 0.0077761579, 0.013468701};
12351
12511
      
12385
12545
        derivatives[r] = 0.0;
12386
12546
      }// end loop over 'r'
12387
12547
      
 
12548
      // Declare pointer to array of reference derivatives on physical element.
 
12549
      double *derivatives_p = new double[2*num_derivatives];
 
12550
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
12551
      {
 
12552
        derivatives_p[r] = 0.0;
 
12553
      }// end loop over 'r'
 
12554
      
12388
12555
      // Declare derivative matrix (of polynomial basis).
12389
12556
      double dmats[10][10] = \
12390
12557
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
12483
12650
        // Using contravariant Piola transform to map values back to the physical element.
12484
12651
        const double tmp_ref0 = derivatives[r];
12485
12652
        const double tmp_ref1 = derivatives[num_derivatives + r];
12486
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
12487
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
12653
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
12654
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
12488
12655
      }// end loop over 'r'
12489
12656
      
12490
12657
      // Transform derivatives back to physical element
12492
12659
      {
12493
12660
        for (unsigned int s = 0; s < num_derivatives; s++)
12494
12661
        {
12495
 
          values[3*num_derivatives + r] += transform[r][s]*derivatives[s];
12496
 
          values[4*num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
12662
          values[3*num_derivatives + r] += transform[r][s]*derivatives_p[s];
 
12663
          values[4*num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
12497
12664
        }// end loop over 's'
12498
12665
      }// end loop over 'r'
12499
12666
      
12500
12667
      // Delete pointer to array of derivatives on FIAT element
12501
12668
      delete [] derivatives;
12502
12669
      
 
12670
      // Delete pointer to array of reference derivatives on physical element.
 
12671
      delete [] derivatives_p;
 
12672
      
12503
12673
      // Delete pointer to array of combinations of derivatives and transform
12504
12674
      for (unsigned int r = 0; r < num_derivatives; r++)
12505
12675
      {
12516
12686
    case 12:
12517
12687
      {
12518
12688
        
12519
 
      // Array of basisvalues.
 
12689
      // Array of basisvalues
12520
12690
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
12521
12691
      
12522
 
      // Declare helper variables.
 
12692
      // Declare helper variables
12523
12693
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
12524
12694
      double tmp1 = (1.0 - Y)/2.0;
12525
12695
      double tmp2 = tmp1*tmp1;
12526
12696
      
12527
 
      // Compute basisvalues.
 
12697
      // Compute basisvalues
12528
12698
      basisvalues[0] = 1.0;
12529
12699
      basisvalues[1] = tmp0;
12530
12700
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
12546
12716
      basisvalues[7] *= std::sqrt(10.0);
12547
12717
      basisvalues[6] *= std::sqrt(14.0);
12548
12718
      
12549
 
      // Table(s) of coefficients.
 
12719
      // Table(s) of coefficients
12550
12720
      static const double coefficients0[10] = \
12551
12721
      {-0.37712362, 0.17320508, -0.1, -0.10432811, -0.56568542, -0.60654032, 0.0, 0.12046772, 0.0, -0.053874802};
12552
12722
      
12586
12756
        derivatives[r] = 0.0;
12587
12757
      }// end loop over 'r'
12588
12758
      
 
12759
      // Declare pointer to array of reference derivatives on physical element.
 
12760
      double *derivatives_p = new double[2*num_derivatives];
 
12761
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
12762
      {
 
12763
        derivatives_p[r] = 0.0;
 
12764
      }// end loop over 'r'
 
12765
      
12589
12766
      // Declare derivative matrix (of polynomial basis).
12590
12767
      double dmats[10][10] = \
12591
12768
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
12684
12861
        // Using contravariant Piola transform to map values back to the physical element.
12685
12862
        const double tmp_ref0 = derivatives[r];
12686
12863
        const double tmp_ref1 = derivatives[num_derivatives + r];
12687
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
12688
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
12864
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
12865
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
12689
12866
      }// end loop over 'r'
12690
12867
      
12691
12868
      // Transform derivatives back to physical element
12693
12870
      {
12694
12871
        for (unsigned int s = 0; s < num_derivatives; s++)
12695
12872
        {
12696
 
          values[3*num_derivatives + r] += transform[r][s]*derivatives[s];
12697
 
          values[4*num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
12873
          values[3*num_derivatives + r] += transform[r][s]*derivatives_p[s];
 
12874
          values[4*num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
12698
12875
        }// end loop over 's'
12699
12876
      }// end loop over 'r'
12700
12877
      
12701
12878
      // Delete pointer to array of derivatives on FIAT element
12702
12879
      delete [] derivatives;
12703
12880
      
 
12881
      // Delete pointer to array of reference derivatives on physical element.
 
12882
      delete [] derivatives_p;
 
12883
      
12704
12884
      // Delete pointer to array of combinations of derivatives and transform
12705
12885
      for (unsigned int r = 0; r < num_derivatives; r++)
12706
12886
      {
12717
12897
    case 13:
12718
12898
      {
12719
12899
        
12720
 
      // Array of basisvalues.
 
12900
      // Array of basisvalues
12721
12901
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
12722
12902
      
12723
 
      // Declare helper variables.
 
12903
      // Declare helper variables
12724
12904
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
12725
12905
      double tmp1 = (1.0 - Y)/2.0;
12726
12906
      double tmp2 = tmp1*tmp1;
12727
12907
      
12728
 
      // Compute basisvalues.
 
12908
      // Compute basisvalues
12729
12909
      basisvalues[0] = 1.0;
12730
12910
      basisvalues[1] = tmp0;
12731
12911
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
12747
12927
      basisvalues[7] *= std::sqrt(10.0);
12748
12928
      basisvalues[6] *= std::sqrt(14.0);
12749
12929
      
12750
 
      // Table(s) of coefficients.
 
12930
      // Table(s) of coefficients
12751
12931
      static const double coefficients0[10] = \
12752
12932
      {0.32998316, -0.096225045, 0.23333333, 0.0, 0.067343503, 0.50156219, 0.0, 0.0, -0.077761579, 0.080812204};
12753
12933
      
12787
12967
        derivatives[r] = 0.0;
12788
12968
      }// end loop over 'r'
12789
12969
      
 
12970
      // Declare pointer to array of reference derivatives on physical element.
 
12971
      double *derivatives_p = new double[2*num_derivatives];
 
12972
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
12973
      {
 
12974
        derivatives_p[r] = 0.0;
 
12975
      }// end loop over 'r'
 
12976
      
12790
12977
      // Declare derivative matrix (of polynomial basis).
12791
12978
      double dmats[10][10] = \
12792
12979
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
12885
13072
        // Using contravariant Piola transform to map values back to the physical element.
12886
13073
        const double tmp_ref0 = derivatives[r];
12887
13074
        const double tmp_ref1 = derivatives[num_derivatives + r];
12888
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
12889
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
13075
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
13076
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
12890
13077
      }// end loop over 'r'
12891
13078
      
12892
13079
      // Transform derivatives back to physical element
12894
13081
      {
12895
13082
        for (unsigned int s = 0; s < num_derivatives; s++)
12896
13083
        {
12897
 
          values[3*num_derivatives + r] += transform[r][s]*derivatives[s];
12898
 
          values[4*num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
13084
          values[3*num_derivatives + r] += transform[r][s]*derivatives_p[s];
 
13085
          values[4*num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
12899
13086
        }// end loop over 's'
12900
13087
      }// end loop over 'r'
12901
13088
      
12902
13089
      // Delete pointer to array of derivatives on FIAT element
12903
13090
      delete [] derivatives;
12904
13091
      
 
13092
      // Delete pointer to array of reference derivatives on physical element.
 
13093
      delete [] derivatives_p;
 
13094
      
12905
13095
      // Delete pointer to array of combinations of derivatives and transform
12906
13096
      for (unsigned int r = 0; r < num_derivatives; r++)
12907
13097
      {
12918
13108
    case 14:
12919
13109
      {
12920
13110
        
12921
 
      // Array of basisvalues.
 
13111
      // Array of basisvalues
12922
13112
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
12923
13113
      
12924
 
      // Declare helper variables.
 
13114
      // Declare helper variables
12925
13115
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
12926
13116
      double tmp1 = (1.0 - Y)/2.0;
12927
13117
      double tmp2 = tmp1*tmp1;
12928
13118
      
12929
 
      // Compute basisvalues.
 
13119
      // Compute basisvalues
12930
13120
      basisvalues[0] = 1.0;
12931
13121
      basisvalues[1] = tmp0;
12932
13122
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
12948
13138
      basisvalues[7] *= std::sqrt(10.0);
12949
13139
      basisvalues[6] *= std::sqrt(14.0);
12950
13140
      
12951
 
      // Table(s) of coefficients.
 
13141
      // Table(s) of coefficients
12952
13142
      static const double coefficients0[10] = \
12953
13143
      {0.14142136, 0.13471506, -0.033333333, 0.15649216, 0.053874802, 0.011664237, 0.1069045, 0.03011693, -0.0077761579, -0.013468701};
12954
13144
      
12988
13178
        derivatives[r] = 0.0;
12989
13179
      }// end loop over 'r'
12990
13180
      
 
13181
      // Declare pointer to array of reference derivatives on physical element.
 
13182
      double *derivatives_p = new double[2*num_derivatives];
 
13183
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
13184
      {
 
13185
        derivatives_p[r] = 0.0;
 
13186
      }// end loop over 'r'
 
13187
      
12991
13188
      // Declare derivative matrix (of polynomial basis).
12992
13189
      double dmats[10][10] = \
12993
13190
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
13086
13283
        // Using contravariant Piola transform to map values back to the physical element.
13087
13284
        const double tmp_ref0 = derivatives[r];
13088
13285
        const double tmp_ref1 = derivatives[num_derivatives + r];
13089
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
13090
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
13286
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
13287
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
13091
13288
      }// end loop over 'r'
13092
13289
      
13093
13290
      // Transform derivatives back to physical element
13095
13292
      {
13096
13293
        for (unsigned int s = 0; s < num_derivatives; s++)
13097
13294
        {
13098
 
          values[3*num_derivatives + r] += transform[r][s]*derivatives[s];
13099
 
          values[4*num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
13295
          values[3*num_derivatives + r] += transform[r][s]*derivatives_p[s];
 
13296
          values[4*num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
13100
13297
        }// end loop over 's'
13101
13298
      }// end loop over 'r'
13102
13299
      
13103
13300
      // Delete pointer to array of derivatives on FIAT element
13104
13301
      delete [] derivatives;
13105
13302
      
 
13303
      // Delete pointer to array of reference derivatives on physical element.
 
13304
      delete [] derivatives_p;
 
13305
      
13106
13306
      // Delete pointer to array of combinations of derivatives and transform
13107
13307
      for (unsigned int r = 0; r < num_derivatives; r++)
13108
13308
      {
13119
13319
    case 15:
13120
13320
      {
13121
13321
        
13122
 
      // Array of basisvalues.
 
13322
      // Array of basisvalues
13123
13323
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
13124
13324
      
13125
 
      // Declare helper variables.
 
13325
      // Declare helper variables
13126
13326
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
13127
13327
      double tmp1 = (1.0 - Y)/2.0;
13128
13328
      double tmp2 = tmp1*tmp1;
13129
13329
      
13130
 
      // Compute basisvalues.
 
13330
      // Compute basisvalues
13131
13331
      basisvalues[0] = 1.0;
13132
13332
      basisvalues[1] = tmp0;
13133
13333
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
13149
13349
      basisvalues[7] *= std::sqrt(10.0);
13150
13350
      basisvalues[6] *= std::sqrt(14.0);
13151
13351
      
13152
 
      // Table(s) of coefficients.
 
13352
      // Table(s) of coefficients
13153
13353
      static const double coefficients0[10] = \
13154
13354
      {-0.18856181, -0.32716515, 0.1, -0.41731242, 0.080812204, 0.023328474, -0.21380899, 0.06023386, 0.015552316, -0.026937401};
13155
13355
      
13189
13389
        derivatives[r] = 0.0;
13190
13390
      }// end loop over 'r'
13191
13391
      
 
13392
      // Declare pointer to array of reference derivatives on physical element.
 
13393
      double *derivatives_p = new double[2*num_derivatives];
 
13394
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
13395
      {
 
13396
        derivatives_p[r] = 0.0;
 
13397
      }// end loop over 'r'
 
13398
      
13192
13399
      // Declare derivative matrix (of polynomial basis).
13193
13400
      double dmats[10][10] = \
13194
13401
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
13287
13494
        // Using contravariant Piola transform to map values back to the physical element.
13288
13495
        const double tmp_ref0 = derivatives[r];
13289
13496
        const double tmp_ref1 = derivatives[num_derivatives + r];
13290
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
13291
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
13497
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
13498
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
13292
13499
      }// end loop over 'r'
13293
13500
      
13294
13501
      // Transform derivatives back to physical element
13296
13503
      {
13297
13504
        for (unsigned int s = 0; s < num_derivatives; s++)
13298
13505
        {
13299
 
          values[3*num_derivatives + r] += transform[r][s]*derivatives[s];
13300
 
          values[4*num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
13506
          values[3*num_derivatives + r] += transform[r][s]*derivatives_p[s];
 
13507
          values[4*num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
13301
13508
        }// end loop over 's'
13302
13509
      }// end loop over 'r'
13303
13510
      
13304
13511
      // Delete pointer to array of derivatives on FIAT element
13305
13512
      delete [] derivatives;
13306
13513
      
 
13514
      // Delete pointer to array of reference derivatives on physical element.
 
13515
      delete [] derivatives_p;
 
13516
      
13307
13517
      // Delete pointer to array of combinations of derivatives and transform
13308
13518
      for (unsigned int r = 0; r < num_derivatives; r++)
13309
13519
      {
13320
13530
    case 16:
13321
13531
      {
13322
13532
        
13323
 
      // Array of basisvalues.
 
13533
      // Array of basisvalues
13324
13534
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
13325
13535
      
13326
 
      // Declare helper variables.
 
13536
      // Declare helper variables
13327
13537
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
13328
13538
      double tmp1 = (1.0 - Y)/2.0;
13329
13539
      double tmp2 = tmp1*tmp1;
13330
13540
      
13331
 
      // Compute basisvalues.
 
13541
      // Compute basisvalues
13332
13542
      basisvalues[0] = 1.0;
13333
13543
      basisvalues[1] = tmp0;
13334
13544
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
13350
13560
      basisvalues[7] *= std::sqrt(10.0);
13351
13561
      basisvalues[6] *= std::sqrt(14.0);
13352
13562
      
13353
 
      // Table(s) of coefficients.
 
13563
      // Table(s) of coefficients
13354
13564
      static const double coefficients0[10] = \
13355
13565
      {0.18856181, 0.28867513, -0.16666667, 0.26082027, -0.20203051, 0.11664237, 0.1069045, -0.09035079, 0.069985421, -0.040406102};
13356
13566
      
13390
13600
        derivatives[r] = 0.0;
13391
13601
      }// end loop over 'r'
13392
13602
      
 
13603
      // Declare pointer to array of reference derivatives on physical element.
 
13604
      double *derivatives_p = new double[2*num_derivatives];
 
13605
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
13606
      {
 
13607
        derivatives_p[r] = 0.0;
 
13608
      }// end loop over 'r'
 
13609
      
13393
13610
      // Declare derivative matrix (of polynomial basis).
13394
13611
      double dmats[10][10] = \
13395
13612
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
13488
13705
        // Using contravariant Piola transform to map values back to the physical element.
13489
13706
        const double tmp_ref0 = derivatives[r];
13490
13707
        const double tmp_ref1 = derivatives[num_derivatives + r];
13491
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
13492
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
13708
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
13709
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
13493
13710
      }// end loop over 'r'
13494
13711
      
13495
13712
      // Transform derivatives back to physical element
13497
13714
      {
13498
13715
        for (unsigned int s = 0; s < num_derivatives; s++)
13499
13716
        {
13500
 
          values[3*num_derivatives + r] += transform[r][s]*derivatives[s];
13501
 
          values[4*num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
13717
          values[3*num_derivatives + r] += transform[r][s]*derivatives_p[s];
 
13718
          values[4*num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
13502
13719
        }// end loop over 's'
13503
13720
      }// end loop over 'r'
13504
13721
      
13505
13722
      // Delete pointer to array of derivatives on FIAT element
13506
13723
      delete [] derivatives;
13507
13724
      
 
13725
      // Delete pointer to array of reference derivatives on physical element.
 
13726
      delete [] derivatives_p;
 
13727
      
13508
13728
      // Delete pointer to array of combinations of derivatives and transform
13509
13729
      for (unsigned int r = 0; r < num_derivatives; r++)
13510
13730
      {
13521
13741
    case 17:
13522
13742
      {
13523
13743
        
13524
 
      // Array of basisvalues.
 
13744
      // Array of basisvalues
13525
13745
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
13526
13746
      
13527
 
      // Declare helper variables.
 
13747
      // Declare helper variables
13528
13748
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
13529
13749
      double tmp1 = (1.0 - Y)/2.0;
13530
13750
      double tmp2 = tmp1*tmp1;
13531
13751
      
13532
 
      // Compute basisvalues.
 
13752
      // Compute basisvalues
13533
13753
      basisvalues[0] = 1.0;
13534
13754
      basisvalues[1] = tmp0;
13535
13755
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
13551
13771
      basisvalues[7] *= std::sqrt(10.0);
13552
13772
      basisvalues[6] *= std::sqrt(14.0);
13553
13773
      
13554
 
      // Table(s) of coefficients.
 
13774
      // Table(s) of coefficients
13555
13775
      static const double coefficients0[10] = \
13556
13776
      {0.32998316, -0.69282032, -0.53333333, -0.39992441, -0.026937401, 0.20606818, 0.32071349, -0.03011693, -0.023328474, 0.013468701};
13557
13777
      
13591
13811
        derivatives[r] = 0.0;
13592
13812
      }// end loop over 'r'
13593
13813
      
 
13814
      // Declare pointer to array of reference derivatives on physical element.
 
13815
      double *derivatives_p = new double[2*num_derivatives];
 
13816
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
13817
      {
 
13818
        derivatives_p[r] = 0.0;
 
13819
      }// end loop over 'r'
 
13820
      
13594
13821
      // Declare derivative matrix (of polynomial basis).
13595
13822
      double dmats[10][10] = \
13596
13823
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
13689
13916
        // Using contravariant Piola transform to map values back to the physical element.
13690
13917
        const double tmp_ref0 = derivatives[r];
13691
13918
        const double tmp_ref1 = derivatives[num_derivatives + r];
13692
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
13693
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
13919
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
13920
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
13694
13921
      }// end loop over 'r'
13695
13922
      
13696
13923
      // Transform derivatives back to physical element
13698
13925
      {
13699
13926
        for (unsigned int s = 0; s < num_derivatives; s++)
13700
13927
        {
13701
 
          values[3*num_derivatives + r] += transform[r][s]*derivatives[s];
13702
 
          values[4*num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
13928
          values[3*num_derivatives + r] += transform[r][s]*derivatives_p[s];
 
13929
          values[4*num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
13703
13930
        }// end loop over 's'
13704
13931
      }// end loop over 'r'
13705
13932
      
13706
13933
      // Delete pointer to array of derivatives on FIAT element
13707
13934
      delete [] derivatives;
13708
13935
      
 
13936
      // Delete pointer to array of reference derivatives on physical element.
 
13937
      delete [] derivatives_p;
 
13938
      
13709
13939
      // Delete pointer to array of combinations of derivatives and transform
13710
13940
      for (unsigned int r = 0; r < num_derivatives; r++)
13711
13941
      {
13722
13952
    case 18:
13723
13953
      {
13724
13954
        
13725
 
      // Array of basisvalues.
 
13955
      // Array of basisvalues
13726
13956
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
13727
13957
      
13728
 
      // Declare helper variables.
 
13958
      // Declare helper variables
13729
13959
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
13730
13960
      double tmp1 = (1.0 - Y)/2.0;
13731
13961
      double tmp2 = tmp1*tmp1;
13732
13962
      
13733
 
      // Compute basisvalues.
 
13963
      // Compute basisvalues
13734
13964
      basisvalues[0] = 1.0;
13735
13965
      basisvalues[1] = tmp0;
13736
13966
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
13752
13982
      basisvalues[7] *= std::sqrt(10.0);
13753
13983
      basisvalues[6] *= std::sqrt(14.0);
13754
13984
      
13755
 
      // Table(s) of coefficients.
 
13985
      // Table(s) of coefficients
13756
13986
      static const double coefficients0[10] = \
13757
13987
      {0.56568542, 0.65433031, -0.46666667, -0.19126819, -0.094280904, 0.12441853, -0.32071349, 0.15058465, -0.054433105, 0.013468701};
13758
13988
      
13792
14022
        derivatives[r] = 0.0;
13793
14023
      }// end loop over 'r'
13794
14024
      
 
14025
      // Declare pointer to array of reference derivatives on physical element.
 
14026
      double *derivatives_p = new double[2*num_derivatives];
 
14027
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
14028
      {
 
14029
        derivatives_p[r] = 0.0;
 
14030
      }// end loop over 'r'
 
14031
      
13795
14032
      // Declare derivative matrix (of polynomial basis).
13796
14033
      double dmats[10][10] = \
13797
14034
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
13890
14127
        // Using contravariant Piola transform to map values back to the physical element.
13891
14128
        const double tmp_ref0 = derivatives[r];
13892
14129
        const double tmp_ref1 = derivatives[num_derivatives + r];
13893
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
13894
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
14130
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
14131
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
13895
14132
      }// end loop over 'r'
13896
14133
      
13897
14134
      // Transform derivatives back to physical element
13899
14136
      {
13900
14137
        for (unsigned int s = 0; s < num_derivatives; s++)
13901
14138
        {
13902
 
          values[3*num_derivatives + r] += transform[r][s]*derivatives[s];
13903
 
          values[4*num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
14139
          values[3*num_derivatives + r] += transform[r][s]*derivatives_p[s];
 
14140
          values[4*num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
13904
14141
        }// end loop over 's'
13905
14142
      }// end loop over 'r'
13906
14143
      
13907
14144
      // Delete pointer to array of derivatives on FIAT element
13908
14145
      delete [] derivatives;
13909
14146
      
 
14147
      // Delete pointer to array of reference derivatives on physical element.
 
14148
      delete [] derivatives_p;
 
14149
      
13910
14150
      // Delete pointer to array of combinations of derivatives and transform
13911
14151
      for (unsigned int r = 0; r < num_derivatives; r++)
13912
14152
      {
13923
14163
    case 19:
13924
14164
      {
13925
14165
        
13926
 
      // Array of basisvalues.
 
14166
      // Array of basisvalues
13927
14167
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
13928
14168
      
13929
 
      // Declare helper variables.
 
14169
      // Declare helper variables
13930
14170
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
13931
14171
      double tmp1 = (1.0 - Y)/2.0;
13932
14172
      double tmp2 = tmp1*tmp1;
13933
14173
      
13934
 
      // Compute basisvalues.
 
14174
      // Compute basisvalues
13935
14175
      basisvalues[0] = 1.0;
13936
14176
      basisvalues[1] = tmp0;
13937
14177
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
13953
14193
      basisvalues[7] *= std::sqrt(10.0);
13954
14194
      basisvalues[6] *= std::sqrt(14.0);
13955
14195
      
13956
 
      // Table(s) of coefficients.
 
14196
      // Table(s) of coefficients
13957
14197
      static const double coefficients0[10] = \
13958
14198
      {0.094280904, 0.076980036, 0.93333333, 0.20865621, 0.24243661, -0.443241, 0.0, -0.24093544, 0.15552316, -0.053874802};
13959
14199
      
13993
14233
        derivatives[r] = 0.0;
13994
14234
      }// end loop over 'r'
13995
14235
      
 
14236
      // Declare pointer to array of reference derivatives on physical element.
 
14237
      double *derivatives_p = new double[2*num_derivatives];
 
14238
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
14239
      {
 
14240
        derivatives_p[r] = 0.0;
 
14241
      }// end loop over 'r'
 
14242
      
13996
14243
      // Declare derivative matrix (of polynomial basis).
13997
14244
      double dmats[10][10] = \
13998
14245
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
14091
14338
        // Using contravariant Piola transform to map values back to the physical element.
14092
14339
        const double tmp_ref0 = derivatives[r];
14093
14340
        const double tmp_ref1 = derivatives[num_derivatives + r];
14094
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
14095
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
14341
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
14342
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
14096
14343
      }// end loop over 'r'
14097
14344
      
14098
14345
      // Transform derivatives back to physical element
14100
14347
      {
14101
14348
        for (unsigned int s = 0; s < num_derivatives; s++)
14102
14349
        {
14103
 
          values[3*num_derivatives + r] += transform[r][s]*derivatives[s];
14104
 
          values[4*num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
14350
          values[3*num_derivatives + r] += transform[r][s]*derivatives_p[s];
 
14351
          values[4*num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
14105
14352
        }// end loop over 's'
14106
14353
      }// end loop over 'r'
14107
14354
      
14108
14355
      // Delete pointer to array of derivatives on FIAT element
14109
14356
      delete [] derivatives;
14110
14357
      
 
14358
      // Delete pointer to array of reference derivatives on physical element.
 
14359
      delete [] derivatives_p;
 
14360
      
14111
14361
      // Delete pointer to array of combinations of derivatives and transform
14112
14362
      for (unsigned int r = 0; r < num_derivatives; r++)
14113
14363
      {
14124
14374
    case 20:
14125
14375
      {
14126
14376
        
14127
 
      // Array of basisvalues.
 
14377
      // Array of basisvalues
14128
14378
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
14129
14379
      
14130
 
      // Declare helper variables.
 
14380
      // Declare helper variables
14131
14381
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
14132
14382
      double tmp1 = (1.0 - Y)/2.0;
14133
14383
      double tmp2 = tmp1*tmp1;
14134
14384
      
14135
 
      // Compute basisvalues.
 
14385
      // Compute basisvalues
14136
14386
      basisvalues[0] = 1.0;
14137
14387
      basisvalues[1] = tmp0;
14138
14388
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
14154
14404
      basisvalues[7] *= std::sqrt(10.0);
14155
14405
      basisvalues[6] *= std::sqrt(14.0);
14156
14406
      
14157
 
      // Table(s) of coefficients.
 
14407
      // Table(s) of coefficients
14158
14408
      static const double coefficients0[10] = \
14159
14409
      {0.23570226, 0.076980036, 0.0, 0.052164053, 0.24243661, 0.058321184, 0.1069045, 0.15058465, -0.0077761579, -0.067343503};
14160
14410
      
14194
14444
        derivatives[r] = 0.0;
14195
14445
      }// end loop over 'r'
14196
14446
      
 
14447
      // Declare pointer to array of reference derivatives on physical element.
 
14448
      double *derivatives_p = new double[2*num_derivatives];
 
14449
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
14450
      {
 
14451
        derivatives_p[r] = 0.0;
 
14452
      }// end loop over 'r'
 
14453
      
14197
14454
      // Declare derivative matrix (of polynomial basis).
14198
14455
      double dmats[10][10] = \
14199
14456
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
14292
14549
        // Using contravariant Piola transform to map values back to the physical element.
14293
14550
        const double tmp_ref0 = derivatives[r];
14294
14551
        const double tmp_ref1 = derivatives[num_derivatives + r];
14295
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
14296
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
14552
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
14553
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
14297
14554
      }// end loop over 'r'
14298
14555
      
14299
14556
      // Transform derivatives back to physical element
14301
14558
      {
14302
14559
        for (unsigned int s = 0; s < num_derivatives; s++)
14303
14560
        {
14304
 
          values[3*num_derivatives + r] += transform[r][s]*derivatives[s];
14305
 
          values[4*num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
14561
          values[3*num_derivatives + r] += transform[r][s]*derivatives_p[s];
 
14562
          values[4*num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
14306
14563
        }// end loop over 's'
14307
14564
      }// end loop over 'r'
14308
14565
      
14309
14566
      // Delete pointer to array of derivatives on FIAT element
14310
14567
      delete [] derivatives;
14311
14568
      
 
14569
      // Delete pointer to array of reference derivatives on physical element.
 
14570
      delete [] derivatives_p;
 
14571
      
14312
14572
      // Delete pointer to array of combinations of derivatives and transform
14313
14573
      for (unsigned int r = 0; r < num_derivatives; r++)
14314
14574
      {
14325
14585
    case 21:
14326
14586
      {
14327
14587
        
14328
 
      // Array of basisvalues.
 
14588
      // Array of basisvalues
14329
14589
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
14330
14590
      
14331
 
      // Declare helper variables.
 
14591
      // Declare helper variables
14332
14592
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
14333
14593
      double tmp1 = (1.0 - Y)/2.0;
14334
14594
      double tmp2 = tmp1*tmp1;
14335
14595
      
14336
 
      // Compute basisvalues.
 
14596
      // Compute basisvalues
14337
14597
      basisvalues[0] = 1.0;
14338
14598
      basisvalues[1] = tmp0;
14339
14599
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
14355
14615
      basisvalues[7] *= std::sqrt(10.0);
14356
14616
      basisvalues[6] *= std::sqrt(14.0);
14357
14617
      
14358
 
      // Table(s) of coefficients.
 
14618
      // Table(s) of coefficients
14359
14619
      static const double coefficients0[10] = \
14360
14620
      {0.0, -0.076980036, -0.13333333, -0.31298432, -0.24243661, 0.27994168, -0.21380899, -0.06023386, 0.17107547, -0.13468701};
14361
14621
      
14395
14655
        derivatives[r] = 0.0;
14396
14656
      }// end loop over 'r'
14397
14657
      
 
14658
      // Declare pointer to array of reference derivatives on physical element.
 
14659
      double *derivatives_p = new double[2*num_derivatives];
 
14660
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
14661
      {
 
14662
        derivatives_p[r] = 0.0;
 
14663
      }// end loop over 'r'
 
14664
      
14398
14665
      // Declare derivative matrix (of polynomial basis).
14399
14666
      double dmats[10][10] = \
14400
14667
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
14493
14760
        // Using contravariant Piola transform to map values back to the physical element.
14494
14761
        const double tmp_ref0 = derivatives[r];
14495
14762
        const double tmp_ref1 = derivatives[num_derivatives + r];
14496
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
14497
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
14763
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
14764
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
14498
14765
      }// end loop over 'r'
14499
14766
      
14500
14767
      // Transform derivatives back to physical element
14502
14769
      {
14503
14770
        for (unsigned int s = 0; s < num_derivatives; s++)
14504
14771
        {
14505
 
          values[3*num_derivatives + r] += transform[r][s]*derivatives[s];
14506
 
          values[4*num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
14772
          values[3*num_derivatives + r] += transform[r][s]*derivatives_p[s];
 
14773
          values[4*num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
14507
14774
        }// end loop over 's'
14508
14775
      }// end loop over 'r'
14509
14776
      
14510
14777
      // Delete pointer to array of derivatives on FIAT element
14511
14778
      delete [] derivatives;
14512
14779
      
 
14780
      // Delete pointer to array of reference derivatives on physical element.
 
14781
      delete [] derivatives_p;
 
14782
      
14513
14783
      // Delete pointer to array of combinations of derivatives and transform
14514
14784
      for (unsigned int r = 0; r < num_derivatives; r++)
14515
14785
      {
14526
14796
    case 22:
14527
14797
      {
14528
14798
        
14529
 
      // Array of basisvalues.
 
14799
      // Array of basisvalues
14530
14800
      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
14531
14801
      
14532
 
      // Declare helper variables.
 
14802
      // Declare helper variables
14533
14803
      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
14534
14804
      double tmp1 = (1.0 - Y)/2.0;
14535
14805
      double tmp2 = tmp1*tmp1;
14536
14806
      
14537
 
      // Compute basisvalues.
 
14807
      // Compute basisvalues
14538
14808
      basisvalues[0] = 1.0;
14539
14809
      basisvalues[1] = tmp0;
14540
14810
      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
14556
14826
      basisvalues[7] *= std::sqrt(10.0);
14557
14827
      basisvalues[6] *= std::sqrt(14.0);
14558
14828
      
14559
 
      // Table(s) of coefficients.
 
14829
      // Table(s) of coefficients
14560
14830
      static const double coefficients0[10] = \
14561
14831
      {-0.23570226, -0.038490018, 0.066666667, 0.10432811, -0.12121831, -0.19829203, 0.0, -0.12046772, -0.077761579, 0.13468701};
14562
14832
      
14596
14866
        derivatives[r] = 0.0;
14597
14867
      }// end loop over 'r'
14598
14868
      
 
14869
      // Declare pointer to array of reference derivatives on physical element.
 
14870
      double *derivatives_p = new double[2*num_derivatives];
 
14871
      for (unsigned int r = 0; r < 2*num_derivatives; r++)
 
14872
      {
 
14873
        derivatives_p[r] = 0.0;
 
14874
      }// end loop over 'r'
 
14875
      
14599
14876
      // Declare derivative matrix (of polynomial basis).
14600
14877
      double dmats[10][10] = \
14601
14878
      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
14694
14971
        // Using contravariant Piola transform to map values back to the physical element.
14695
14972
        const double tmp_ref0 = derivatives[r];
14696
14973
        const double tmp_ref1 = derivatives[num_derivatives + r];
14697
 
        derivatives[r] = (1.0/detJ)*(J_00*tmp_ref0 + J_01*tmp_ref1);
14698
 
        derivatives[num_derivatives + r] = (1.0/detJ)*(J_10*tmp_ref0 + J_11*tmp_ref1);
 
14974
        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
 
14975
        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
14699
14976
      }// end loop over 'r'
14700
14977
      
14701
14978
      // Transform derivatives back to physical element
14703
14980
      {
14704
14981
        for (unsigned int s = 0; s < num_derivatives; s++)
14705
14982
        {
14706
 
          values[3*num_derivatives + r] += transform[r][s]*derivatives[s];
14707
 
          values[4*num_derivatives + r] += transform[r][s]*derivatives[num_derivatives + s];
 
14983
          values[3*num_derivatives + r] += transform[r][s]*derivatives_p[s];
 
14984
          values[4*num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
14708
14985
        }// end loop over 's'
14709
14986
      }// end loop over 'r'
14710
14987
      
14711
14988
      // Delete pointer to array of derivatives on FIAT element
14712
14989
      delete [] derivatives;
14713
14990
      
 
14991
      // Delete pointer to array of reference derivatives on physical element.
 
14992
      delete [] derivatives_p;
 
14993
      
14714
14994
      // Delete pointer to array of combinations of derivatives and transform
14715
14995
      for (unsigned int r = 0; r < num_derivatives; r++)
14716
14996
      {
14728
15008
    
14729
15009
  }
14730
15010
 
14731
 
  /// Evaluate order n derivatives of all basis functions at given point in cell
14732
 
  virtual void evaluate_basis_derivatives_all(unsigned int n,
 
15011
  /// Evaluate order n derivatives of all basis functions at given point x in cell
 
15012
  virtual void evaluate_basis_derivatives_all(std::size_t n,
14733
15013
                                              double* values,
14734
 
                                              const double* coordinates,
14735
 
                                              const ufc::cell& c) const
 
15014
                                              const double* x,
 
15015
                                              const double* vertex_coordinates,
 
15016
                                              int cell_orientation) const
14736
15017
  {
14737
15018
    // Compute number of derivatives.
14738
15019
    unsigned int num_derivatives = 1;
14751
15032
    // Loop dofs and call evaluate_basis_derivatives.
14752
15033
    for (unsigned int r = 0; r < 23; r++)
14753
15034
    {
14754
 
      evaluate_basis_derivatives(r, n, dof_values, coordinates, c);
 
15035
      evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
14755
15036
      for (unsigned int s = 0; s < 5*num_derivatives; s++)
14756
15037
      {
14757
15038
        values[r*5*num_derivatives + s] = dof_values[s];
14763
15044
  }
14764
15045
 
14765
15046
  /// Evaluate linear functional for dof i on the function f
14766
 
  virtual double evaluate_dof(unsigned int i,
 
15047
  virtual double evaluate_dof(std::size_t i,
14767
15048
                              const ufc::function& f,
 
15049
                              const double* vertex_coordinates,
 
15050
                              int cell_orientation,
14768
15051
                              const ufc::cell& c) const
14769
15052
  {
14770
 
    // Declare variables for result of evaluation.
 
15053
    // Declare variables for result of evaluation
14771
15054
    double vals[5];
14772
15055
    
14773
 
    // Declare variable for physical coordinates.
 
15056
    // Declare variable for physical coordinates
14774
15057
    double y[2];
 
15058
    
14775
15059
    double result;
14776
 
    // Extract vertex coordinates
14777
 
    const double * const * x = c.coordinates;
14778
 
    
14779
 
    // Compute Jacobian of affine map from reference cell
14780
 
    const double J_00 = x[1][0] - x[0][0];
14781
 
    const double J_01 = x[2][0] - x[0][0];
14782
 
    const double J_10 = x[1][1] - x[0][1];
14783
 
    const double J_11 = x[2][1] - x[0][1];
14784
 
    
14785
 
    // Compute determinant of Jacobian
14786
 
    double detJ = J_00*J_11 - J_01*J_10;
14787
 
    
14788
 
    // Compute inverse of Jacobian
14789
 
    const double K_00 =  J_11 / detJ;
14790
 
    const double K_01 = -J_01 / detJ;
14791
 
    const double K_10 = -J_10 / detJ;
14792
 
    const double K_11 =  J_00 / detJ;switch (i)
 
15060
    // Compute Jacobian
 
15061
    double J[4];
 
15062
    compute_jacobian_triangle_2d(J, vertex_coordinates);
 
15063
    
 
15064
    
 
15065
    // Compute Jacobian inverse and determinant
 
15066
    double K[4];
 
15067
    double detJ;
 
15068
    compute_jacobian_inverse_triangle_2d(K, detJ, J);
 
15069
    
 
15070
    
 
15071
    switch (i)
14793
15072
    {
14794
15073
    case 0:
14795
15074
      {
14796
 
        y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
14797
 
      y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
15075
        y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
15076
      y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
14798
15077
      f.evaluate(vals, y, c);
14799
15078
      return vals[0];
14800
15079
        break;
14801
15080
      }
14802
15081
    case 1:
14803
15082
      {
14804
 
        y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
14805
 
      y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
15083
        y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
15084
      y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
14806
15085
      f.evaluate(vals, y, c);
14807
15086
      return vals[1];
14808
15087
        break;
14809
15088
      }
14810
15089
    case 2:
14811
15090
      {
14812
 
        y[0] = x[0][0];
14813
 
      y[1] = x[0][1];
 
15091
        y[0] = vertex_coordinates[0];
 
15092
      y[1] = vertex_coordinates[1];
14814
15093
      f.evaluate(vals, y, c);
14815
15094
      return vals[2];
14816
15095
        break;
14817
15096
      }
14818
15097
    case 3:
14819
15098
      {
14820
 
        y[0] = x[1][0];
14821
 
      y[1] = x[1][1];
 
15099
        y[0] = vertex_coordinates[2];
 
15100
      y[1] = vertex_coordinates[3];
14822
15101
      f.evaluate(vals, y, c);
14823
15102
      return vals[2];
14824
15103
        break;
14825
15104
      }
14826
15105
    case 4:
14827
15106
      {
14828
 
        y[0] = x[2][0];
14829
 
      y[1] = x[2][1];
 
15107
        y[0] = vertex_coordinates[4];
 
15108
      y[1] = vertex_coordinates[5];
14830
15109
      f.evaluate(vals, y, c);
14831
15110
      return vals[2];
14832
15111
        break;
14833
15112
      }
14834
15113
    case 5:
14835
15114
      {
14836
 
        y[0] = 0.5*x[1][0] + 0.5*x[2][0];
14837
 
      y[1] = 0.5*x[1][1] + 0.5*x[2][1];
 
15115
        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
15116
      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
14838
15117
      f.evaluate(vals, y, c);
14839
15118
      return vals[2];
14840
15119
        break;
14841
15120
      }
14842
15121
    case 6:
14843
15122
      {
14844
 
        y[0] = 0.5*x[0][0] + 0.5*x[2][0];
14845
 
      y[1] = 0.5*x[0][1] + 0.5*x[2][1];
 
15123
        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
 
15124
      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
14846
15125
      f.evaluate(vals, y, c);
14847
15126
      return vals[2];
14848
15127
        break;
14849
15128
      }
14850
15129
    case 7:
14851
15130
      {
14852
 
        y[0] = 0.5*x[0][0] + 0.5*x[1][0];
14853
 
      y[1] = 0.5*x[0][1] + 0.5*x[1][1];
 
15131
        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
 
15132
      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
14854
15133
      f.evaluate(vals, y, c);
14855
15134
      return vals[2];
14856
15135
        break;
14857
15136
      }
14858
15137
    case 8:
14859
15138
      {
14860
 
        y[0] = 0.75*x[1][0] + 0.25*x[2][0];
14861
 
      y[1] = 0.75*x[1][1] + 0.25*x[2][1];
 
15139
        y[0] = 0.75*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
15140
      y[1] = 0.75*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
14862
15141
      f.evaluate(vals, y, c);
14863
 
      result = (detJ*(K_00*vals[3] + K_01*vals[4])) + (detJ*(K_10*vals[3] + K_11*vals[4]));
 
15142
      result = (detJ*(K[0]*vals[3] + K[1]*vals[4])) + (detJ*(K[2]*vals[3] + K[3]*vals[4]));
14864
15143
      return result;
14865
15144
        break;
14866
15145
      }
14867
15146
    case 9:
14868
15147
      {
14869
 
        y[0] = 0.5*x[1][0] + 0.5*x[2][0];
14870
 
      y[1] = 0.5*x[1][1] + 0.5*x[2][1];
 
15148
        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
15149
      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
14871
15150
      f.evaluate(vals, y, c);
14872
 
      result = (detJ*(K_00*vals[3] + K_01*vals[4])) + (detJ*(K_10*vals[3] + K_11*vals[4]));
 
15151
      result = (detJ*(K[0]*vals[3] + K[1]*vals[4])) + (detJ*(K[2]*vals[3] + K[3]*vals[4]));
14873
15152
      return result;
14874
15153
        break;
14875
15154
      }
14876
15155
    case 10:
14877
15156
      {
14878
 
        y[0] = 0.25*x[1][0] + 0.75*x[2][0];
14879
 
      y[1] = 0.25*x[1][1] + 0.75*x[2][1];
 
15157
        y[0] = 0.25*vertex_coordinates[2] + 0.75*vertex_coordinates[4];
 
15158
      y[1] = 0.25*vertex_coordinates[3] + 0.75*vertex_coordinates[5];
14880
15159
      f.evaluate(vals, y, c);
14881
 
      result = (detJ*(K_00*vals[3] + K_01*vals[4])) + (detJ*(K_10*vals[3] + K_11*vals[4]));
 
15160
      result = (detJ*(K[0]*vals[3] + K[1]*vals[4])) + (detJ*(K[2]*vals[3] + K[3]*vals[4]));
14882
15161
      return result;
14883
15162
        break;
14884
15163
      }
14885
15164
    case 11:
14886
15165
      {
14887
 
        y[0] = 0.75*x[0][0] + 0.25*x[2][0];
14888
 
      y[1] = 0.75*x[0][1] + 0.25*x[2][1];
 
15166
        y[0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[4];
 
15167
      y[1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[5];
14889
15168
      f.evaluate(vals, y, c);
14890
 
      result = (detJ*(K_00*vals[3] + K_01*vals[4]));
 
15169
      result = (detJ*(K[0]*vals[3] + K[1]*vals[4]));
14891
15170
      return result;
14892
15171
        break;
14893
15172
      }
14894
15173
    case 12:
14895
15174
      {
14896
 
        y[0] = 0.5*x[0][0] + 0.5*x[2][0];
14897
 
      y[1] = 0.5*x[0][1] + 0.5*x[2][1];
 
15175
        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
 
15176
      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
14898
15177
      f.evaluate(vals, y, c);
14899
 
      result = (detJ*(K_00*vals[3] + K_01*vals[4]));
 
15178
      result = (detJ*(K[0]*vals[3] + K[1]*vals[4]));
14900
15179
      return result;
14901
15180
        break;
14902
15181
      }
14903
15182
    case 13:
14904
15183
      {
14905
 
        y[0] = 0.25*x[0][0] + 0.75*x[2][0];
14906
 
      y[1] = 0.25*x[0][1] + 0.75*x[2][1];
 
15184
        y[0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[4];
 
15185
      y[1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[5];
14907
15186
      f.evaluate(vals, y, c);
14908
 
      result = (detJ*(K_00*vals[3] + K_01*vals[4]));
 
15187
      result = (detJ*(K[0]*vals[3] + K[1]*vals[4]));
14909
15188
      return result;
14910
15189
        break;
14911
15190
      }
14912
15191
    case 14:
14913
15192
      {
14914
 
        y[0] = 0.75*x[0][0] + 0.25*x[1][0];
14915
 
      y[1] = 0.75*x[0][1] + 0.25*x[1][1];
 
15193
        y[0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[2];
 
15194
      y[1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[3];
14916
15195
      f.evaluate(vals, y, c);
14917
 
      result = (-1.0)*(detJ*(K_10*vals[3] + K_11*vals[4]));
 
15196
      result = (-1.0)*(detJ*(K[2]*vals[3] + K[3]*vals[4]));
14918
15197
      return result;
14919
15198
        break;
14920
15199
      }
14921
15200
    case 15:
14922
15201
      {
14923
 
        y[0] = 0.5*x[0][0] + 0.5*x[1][0];
14924
 
      y[1] = 0.5*x[0][1] + 0.5*x[1][1];
 
15202
        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
 
15203
      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
14925
15204
      f.evaluate(vals, y, c);
14926
 
      result = (-1.0)*(detJ*(K_10*vals[3] + K_11*vals[4]));
 
15205
      result = (-1.0)*(detJ*(K[2]*vals[3] + K[3]*vals[4]));
14927
15206
      return result;
14928
15207
        break;
14929
15208
      }
14930
15209
    case 16:
14931
15210
      {
14932
 
        y[0] = 0.25*x[0][0] + 0.75*x[1][0];
14933
 
      y[1] = 0.25*x[0][1] + 0.75*x[1][1];
 
15211
        y[0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[2];
 
15212
      y[1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[3];
14934
15213
      f.evaluate(vals, y, c);
14935
 
      result = (-1.0)*(detJ*(K_10*vals[3] + K_11*vals[4]));
 
15214
      result = (-1.0)*(detJ*(K[2]*vals[3] + K[3]*vals[4]));
14936
15215
      return result;
14937
15216
        break;
14938
15217
      }
14939
15218
    case 17:
14940
15219
      {
14941
 
        y[0] = 0.5*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0];
14942
 
      y[1] = 0.5*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1];
 
15220
        y[0] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
15221
      y[1] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
14943
15222
      f.evaluate(vals, y, c);
14944
 
      result = (detJ*(K_00*vals[3] + K_01*vals[4]));
 
15223
      result = (detJ*(K[0]*vals[3] + K[1]*vals[4]));
14945
15224
      return result;
14946
15225
        break;
14947
15226
      }
14948
15227
    case 18:
14949
15228
      {
14950
 
        y[0] = 0.25*x[0][0] + 0.5*x[1][0] + 0.25*x[2][0];
14951
 
      y[1] = 0.25*x[0][1] + 0.5*x[1][1] + 0.25*x[2][1];
 
15229
        y[0] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
15230
      y[1] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
14952
15231
      f.evaluate(vals, y, c);
14953
 
      result = (detJ*(K_00*vals[3] + K_01*vals[4]));
 
15232
      result = (detJ*(K[0]*vals[3] + K[1]*vals[4]));
14954
15233
      return result;
14955
15234
        break;
14956
15235
      }
14957
15236
    case 19:
14958
15237
      {
14959
 
        y[0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.5*x[2][0];
14960
 
      y[1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.5*x[2][1];
 
15238
        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
15239
      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
14961
15240
      f.evaluate(vals, y, c);
14962
 
      result = (detJ*(K_00*vals[3] + K_01*vals[4]));
 
15241
      result = (detJ*(K[0]*vals[3] + K[1]*vals[4]));
14963
15242
      return result;
14964
15243
        break;
14965
15244
      }
14966
15245
    case 20:
14967
15246
      {
14968
 
        y[0] = 0.5*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0];
14969
 
      y[1] = 0.5*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1];
 
15247
        y[0] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
15248
      y[1] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
14970
15249
      f.evaluate(vals, y, c);
14971
 
      result = (detJ*(K_10*vals[3] + K_11*vals[4]));
 
15250
      result = (detJ*(K[2]*vals[3] + K[3]*vals[4]));
14972
15251
      return result;
14973
15252
        break;
14974
15253
      }
14975
15254
    case 21:
14976
15255
      {
14977
 
        y[0] = 0.25*x[0][0] + 0.5*x[1][0] + 0.25*x[2][0];
14978
 
      y[1] = 0.25*x[0][1] + 0.5*x[1][1] + 0.25*x[2][1];
 
15256
        y[0] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
15257
      y[1] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
14979
15258
      f.evaluate(vals, y, c);
14980
 
      result = (detJ*(K_10*vals[3] + K_11*vals[4]));
 
15259
      result = (detJ*(K[2]*vals[3] + K[3]*vals[4]));
14981
15260
      return result;
14982
15261
        break;
14983
15262
      }
14984
15263
    case 22:
14985
15264
      {
14986
 
        y[0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.5*x[2][0];
14987
 
      y[1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.5*x[2][1];
 
15265
        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
15266
      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
14988
15267
      f.evaluate(vals, y, c);
14989
 
      result = (detJ*(K_10*vals[3] + K_11*vals[4]));
 
15268
      result = (detJ*(K[2]*vals[3] + K[3]*vals[4]));
14990
15269
      return result;
14991
15270
        break;
14992
15271
      }
14998
15277
  /// Evaluate linear functionals for all dofs on the function f
14999
15278
  virtual void evaluate_dofs(double* values,
15000
15279
                             const ufc::function& f,
 
15280
                             const double* vertex_coordinates,
 
15281
                             int cell_orientation,
15001
15282
                             const ufc::cell& c) const
15002
15283
  {
15003
 
    // Declare variables for result of evaluation.
 
15284
    // Declare variables for result of evaluation
15004
15285
    double vals[5];
15005
15286
    
15006
 
    // Declare variable for physical coordinates.
 
15287
    // Declare variable for physical coordinates
15007
15288
    double y[2];
 
15289
    
15008
15290
    double result;
15009
 
    // Extract vertex coordinates
15010
 
    const double * const * x = c.coordinates;
15011
 
    
15012
 
    // Compute Jacobian of affine map from reference cell
15013
 
    const double J_00 = x[1][0] - x[0][0];
15014
 
    const double J_01 = x[2][0] - x[0][0];
15015
 
    const double J_10 = x[1][1] - x[0][1];
15016
 
    const double J_11 = x[2][1] - x[0][1];
15017
 
    
15018
 
    // Compute determinant of Jacobian
15019
 
    double detJ = J_00*J_11 - J_01*J_10;
15020
 
    
15021
 
    // Compute inverse of Jacobian
15022
 
    const double K_00 =  J_11 / detJ;
15023
 
    const double K_01 = -J_01 / detJ;
15024
 
    const double K_10 = -J_10 / detJ;
15025
 
    const double K_11 =  J_00 / detJ;y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
15026
 
    y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
15291
    // Compute Jacobian
 
15292
    double J[4];
 
15293
    compute_jacobian_triangle_2d(J, vertex_coordinates);
 
15294
    
 
15295
    
 
15296
    // Compute Jacobian inverse and determinant
 
15297
    double K[4];
 
15298
    double detJ;
 
15299
    compute_jacobian_inverse_triangle_2d(K, detJ, J);
 
15300
    
 
15301
    
 
15302
    y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
15303
    y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
15027
15304
    f.evaluate(vals, y, c);
15028
15305
    values[0] = vals[0];
15029
 
    y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
15030
 
    y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
15306
    y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
15307
    y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
15031
15308
    f.evaluate(vals, y, c);
15032
15309
    values[1] = vals[1];
15033
 
    y[0] = x[0][0];
15034
 
    y[1] = x[0][1];
 
15310
    y[0] = vertex_coordinates[0];
 
15311
    y[1] = vertex_coordinates[1];
15035
15312
    f.evaluate(vals, y, c);
15036
15313
    values[2] = vals[2];
15037
 
    y[0] = x[1][0];
15038
 
    y[1] = x[1][1];
 
15314
    y[0] = vertex_coordinates[2];
 
15315
    y[1] = vertex_coordinates[3];
15039
15316
    f.evaluate(vals, y, c);
15040
15317
    values[3] = vals[2];
15041
 
    y[0] = x[2][0];
15042
 
    y[1] = x[2][1];
 
15318
    y[0] = vertex_coordinates[4];
 
15319
    y[1] = vertex_coordinates[5];
15043
15320
    f.evaluate(vals, y, c);
15044
15321
    values[4] = vals[2];
15045
 
    y[0] = 0.5*x[1][0] + 0.5*x[2][0];
15046
 
    y[1] = 0.5*x[1][1] + 0.5*x[2][1];
 
15322
    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
15323
    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
15047
15324
    f.evaluate(vals, y, c);
15048
15325
    values[5] = vals[2];
15049
 
    y[0] = 0.5*x[0][0] + 0.5*x[2][0];
15050
 
    y[1] = 0.5*x[0][1] + 0.5*x[2][1];
 
15326
    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
 
15327
    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
15051
15328
    f.evaluate(vals, y, c);
15052
15329
    values[6] = vals[2];
15053
 
    y[0] = 0.5*x[0][0] + 0.5*x[1][0];
15054
 
    y[1] = 0.5*x[0][1] + 0.5*x[1][1];
 
15330
    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
 
15331
    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
15055
15332
    f.evaluate(vals, y, c);
15056
15333
    values[7] = vals[2];
15057
 
    y[0] = 0.75*x[1][0] + 0.25*x[2][0];
15058
 
    y[1] = 0.75*x[1][1] + 0.25*x[2][1];
 
15334
    y[0] = 0.75*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
15335
    y[1] = 0.75*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
15059
15336
    f.evaluate(vals, y, c);
15060
 
    result = (detJ*(K_00*vals[3] + K_01*vals[4])) + (detJ*(K_10*vals[3] + K_11*vals[4]));
 
15337
    result = (detJ*(K[0]*vals[3] + K[1]*vals[4])) + (detJ*(K[2]*vals[3] + K[3]*vals[4]));
15061
15338
    values[8] = result;
15062
 
    y[0] = 0.5*x[1][0] + 0.5*x[2][0];
15063
 
    y[1] = 0.5*x[1][1] + 0.5*x[2][1];
 
15339
    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
15340
    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
15064
15341
    f.evaluate(vals, y, c);
15065
 
    result = (detJ*(K_00*vals[3] + K_01*vals[4])) + (detJ*(K_10*vals[3] + K_11*vals[4]));
 
15342
    result = (detJ*(K[0]*vals[3] + K[1]*vals[4])) + (detJ*(K[2]*vals[3] + K[3]*vals[4]));
15066
15343
    values[9] = result;
15067
 
    y[0] = 0.25*x[1][0] + 0.75*x[2][0];
15068
 
    y[1] = 0.25*x[1][1] + 0.75*x[2][1];
 
15344
    y[0] = 0.25*vertex_coordinates[2] + 0.75*vertex_coordinates[4];
 
15345
    y[1] = 0.25*vertex_coordinates[3] + 0.75*vertex_coordinates[5];
15069
15346
    f.evaluate(vals, y, c);
15070
 
    result = (detJ*(K_00*vals[3] + K_01*vals[4])) + (detJ*(K_10*vals[3] + K_11*vals[4]));
 
15347
    result = (detJ*(K[0]*vals[3] + K[1]*vals[4])) + (detJ*(K[2]*vals[3] + K[3]*vals[4]));
15071
15348
    values[10] = result;
15072
 
    y[0] = 0.75*x[0][0] + 0.25*x[2][0];
15073
 
    y[1] = 0.75*x[0][1] + 0.25*x[2][1];
 
15349
    y[0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[4];
 
15350
    y[1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[5];
15074
15351
    f.evaluate(vals, y, c);
15075
 
    result = (detJ*(K_00*vals[3] + K_01*vals[4]));
 
15352
    result = (detJ*(K[0]*vals[3] + K[1]*vals[4]));
15076
15353
    values[11] = result;
15077
 
    y[0] = 0.5*x[0][0] + 0.5*x[2][0];
15078
 
    y[1] = 0.5*x[0][1] + 0.5*x[2][1];
 
15354
    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
 
15355
    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
15079
15356
    f.evaluate(vals, y, c);
15080
 
    result = (detJ*(K_00*vals[3] + K_01*vals[4]));
 
15357
    result = (detJ*(K[0]*vals[3] + K[1]*vals[4]));
15081
15358
    values[12] = result;
15082
 
    y[0] = 0.25*x[0][0] + 0.75*x[2][0];
15083
 
    y[1] = 0.25*x[0][1] + 0.75*x[2][1];
 
15359
    y[0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[4];
 
15360
    y[1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[5];
15084
15361
    f.evaluate(vals, y, c);
15085
 
    result = (detJ*(K_00*vals[3] + K_01*vals[4]));
 
15362
    result = (detJ*(K[0]*vals[3] + K[1]*vals[4]));
15086
15363
    values[13] = result;
15087
 
    y[0] = 0.75*x[0][0] + 0.25*x[1][0];
15088
 
    y[1] = 0.75*x[0][1] + 0.25*x[1][1];
 
15364
    y[0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[2];
 
15365
    y[1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[3];
15089
15366
    f.evaluate(vals, y, c);
15090
 
    result = (-1.0)*(detJ*(K_10*vals[3] + K_11*vals[4]));
 
15367
    result = (-1.0)*(detJ*(K[2]*vals[3] + K[3]*vals[4]));
15091
15368
    values[14] = result;
15092
 
    y[0] = 0.5*x[0][0] + 0.5*x[1][0];
15093
 
    y[1] = 0.5*x[0][1] + 0.5*x[1][1];
 
15369
    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
 
15370
    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
15094
15371
    f.evaluate(vals, y, c);
15095
 
    result = (-1.0)*(detJ*(K_10*vals[3] + K_11*vals[4]));
 
15372
    result = (-1.0)*(detJ*(K[2]*vals[3] + K[3]*vals[4]));
15096
15373
    values[15] = result;
15097
 
    y[0] = 0.25*x[0][0] + 0.75*x[1][0];
15098
 
    y[1] = 0.25*x[0][1] + 0.75*x[1][1];
 
15374
    y[0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[2];
 
15375
    y[1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[3];
15099
15376
    f.evaluate(vals, y, c);
15100
 
    result = (-1.0)*(detJ*(K_10*vals[3] + K_11*vals[4]));
 
15377
    result = (-1.0)*(detJ*(K[2]*vals[3] + K[3]*vals[4]));
15101
15378
    values[16] = result;
15102
 
    y[0] = 0.5*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0];
15103
 
    y[1] = 0.5*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1];
 
15379
    y[0] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
15380
    y[1] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
15104
15381
    f.evaluate(vals, y, c);
15105
 
    result = (detJ*(K_00*vals[3] + K_01*vals[4]));
 
15382
    result = (detJ*(K[0]*vals[3] + K[1]*vals[4]));
15106
15383
    values[17] = result;
15107
 
    y[0] = 0.25*x[0][0] + 0.5*x[1][0] + 0.25*x[2][0];
15108
 
    y[1] = 0.25*x[0][1] + 0.5*x[1][1] + 0.25*x[2][1];
 
15384
    y[0] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
15385
    y[1] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
15109
15386
    f.evaluate(vals, y, c);
15110
 
    result = (detJ*(K_00*vals[3] + K_01*vals[4]));
 
15387
    result = (detJ*(K[0]*vals[3] + K[1]*vals[4]));
15111
15388
    values[18] = result;
15112
 
    y[0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.5*x[2][0];
15113
 
    y[1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.5*x[2][1];
 
15389
    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
15390
    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
15114
15391
    f.evaluate(vals, y, c);
15115
 
    result = (detJ*(K_00*vals[3] + K_01*vals[4]));
 
15392
    result = (detJ*(K[0]*vals[3] + K[1]*vals[4]));
15116
15393
    values[19] = result;
15117
 
    y[0] = 0.5*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0];
15118
 
    y[1] = 0.5*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1];
 
15394
    y[0] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
15395
    y[1] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
15119
15396
    f.evaluate(vals, y, c);
15120
 
    result = (detJ*(K_10*vals[3] + K_11*vals[4]));
 
15397
    result = (detJ*(K[2]*vals[3] + K[3]*vals[4]));
15121
15398
    values[20] = result;
15122
 
    y[0] = 0.25*x[0][0] + 0.5*x[1][0] + 0.25*x[2][0];
15123
 
    y[1] = 0.25*x[0][1] + 0.5*x[1][1] + 0.25*x[2][1];
 
15399
    y[0] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
15400
    y[1] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
15124
15401
    f.evaluate(vals, y, c);
15125
 
    result = (detJ*(K_10*vals[3] + K_11*vals[4]));
 
15402
    result = (detJ*(K[2]*vals[3] + K[3]*vals[4]));
15126
15403
    values[21] = result;
15127
 
    y[0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.5*x[2][0];
15128
 
    y[1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.5*x[2][1];
 
15404
    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
15405
    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
15129
15406
    f.evaluate(vals, y, c);
15130
 
    result = (detJ*(K_10*vals[3] + K_11*vals[4]));
 
15407
    result = (detJ*(K[2]*vals[3] + K[3]*vals[4]));
15131
15408
    values[22] = result;
15132
15409
  }
15133
15410
 
15134
15411
  /// Interpolate vertex values from dof values
15135
15412
  virtual void interpolate_vertex_values(double* vertex_values,
15136
15413
                                         const double* dof_values,
 
15414
                                         const double* vertex_coordinates,
 
15415
                                         int cell_orientation,
15137
15416
                                         const ufc::cell& c) const
15138
15417
  {
15139
 
    // Extract vertex coordinates
15140
 
    const double * const * x = c.coordinates;
15141
 
    
15142
 
    // Compute Jacobian of affine map from reference cell
15143
 
    const double J_00 = x[1][0] - x[0][0];
15144
 
    const double J_01 = x[2][0] - x[0][0];
15145
 
    const double J_10 = x[1][1] - x[0][1];
15146
 
    const double J_11 = x[2][1] - x[0][1];
15147
 
    
15148
 
    // Compute determinant of Jacobian
15149
 
    double detJ = J_00*J_11 - J_01*J_10;
15150
 
    
15151
 
    // Compute inverse of Jacobian
 
15418
    // Compute Jacobian
 
15419
    double J[4];
 
15420
    compute_jacobian_triangle_2d(J, vertex_coordinates);
 
15421
    
 
15422
    
 
15423
    // Compute Jacobian inverse and determinant
 
15424
    double K[4];
 
15425
    double detJ;
 
15426
    compute_jacobian_inverse_triangle_2d(K, detJ, J);
 
15427
    
 
15428
    
 
15429
    
15152
15430
    // Evaluate function and change variables
15153
15431
    vertex_values[0] = dof_values[0];
15154
15432
    vertex_values[5] = dof_values[0];
15162
15440
    vertex_values[7] = dof_values[3];
15163
15441
    vertex_values[12] = dof_values[4];
15164
15442
    // Evaluate function and change variables
15165
 
    vertex_values[3] = dof_values[11]*(1.0/detJ)*J_00*3.0 + dof_values[12]*((1.0/detJ)*(J_00*(-3.0))) + dof_values[13]*(1.0/detJ)*J_00 + dof_values[14]*((1.0/detJ)*(J_01*(-3.0))) + dof_values[15]*(1.0/detJ)*J_01*3.0 + dof_values[16]*((1.0/detJ)*(J_01*(-1.0)));
15166
 
    vertex_values[8] = dof_values[8]*(1.0/detJ)*J_00*3.0 + dof_values[9]*((1.0/detJ)*(J_00*(-3.0))) + dof_values[10]*(1.0/detJ)*J_00 + dof_values[14]*((1.0/detJ)*(J_00 + J_01*(-1.0))) + dof_values[15]*((1.0/detJ)*(J_00*(-3.0) + J_01*3.0)) + dof_values[16]*((1.0/detJ)*(J_00*3.0 + J_01*(-3.0)));
15167
 
    vertex_values[13] = dof_values[8]*(1.0/detJ)*J_01 + dof_values[9]*((1.0/detJ)*(J_01*(-3.0))) + dof_values[10]*(1.0/detJ)*J_01*3.0 + dof_values[11]*((1.0/detJ)*(J_00 + J_01*(-1.0))) + dof_values[12]*((1.0/detJ)*(J_00*(-3.0) + J_01*3.0)) + dof_values[13]*((1.0/detJ)*(J_00*3.0 + J_01*(-3.0)));
15168
 
    vertex_values[4] = dof_values[11]*(1.0/detJ)*J_10*3.0 + dof_values[12]*((1.0/detJ)*(J_10*(-3.0))) + dof_values[13]*(1.0/detJ)*J_10 + dof_values[14]*((1.0/detJ)*(J_11*(-3.0))) + dof_values[15]*(1.0/detJ)*J_11*3.0 + dof_values[16]*((1.0/detJ)*(J_11*(-1.0)));
15169
 
    vertex_values[9] = dof_values[8]*(1.0/detJ)*J_10*3.0 + dof_values[9]*((1.0/detJ)*(J_10*(-3.0))) + dof_values[10]*(1.0/detJ)*J_10 + dof_values[14]*((1.0/detJ)*(J_10 + J_11*(-1.0))) + dof_values[15]*((1.0/detJ)*(J_10*(-3.0) + J_11*3.0)) + dof_values[16]*((1.0/detJ)*(J_10*3.0 + J_11*(-3.0)));
15170
 
    vertex_values[14] = dof_values[8]*(1.0/detJ)*J_11 + dof_values[9]*((1.0/detJ)*(J_11*(-3.0))) + dof_values[10]*(1.0/detJ)*J_11*3.0 + dof_values[11]*((1.0/detJ)*(J_10 + J_11*(-1.0))) + dof_values[12]*((1.0/detJ)*(J_10*(-3.0) + J_11*3.0)) + dof_values[13]*((1.0/detJ)*(J_10*3.0 + J_11*(-3.0)));
 
15443
    vertex_values[3] = dof_values[11]*(1.0/detJ)*J[0]*3.0 + dof_values[12]*((1.0/detJ)*(J[0]*(-3.0))) + dof_values[13]*(1.0/detJ)*J[0] + dof_values[14]*((1.0/detJ)*(J[1]*(-3.0))) + dof_values[15]*(1.0/detJ)*J[1]*3.0 + dof_values[16]*((1.0/detJ)*(J[1]*(-1.0)));
 
15444
    vertex_values[8] = dof_values[8]*(1.0/detJ)*J[0]*3.0 + dof_values[9]*((1.0/detJ)*(J[0]*(-3.0))) + dof_values[10]*(1.0/detJ)*J[0] + dof_values[14]*((1.0/detJ)*(J[0] + J[1]*(-1.0))) + dof_values[15]*((1.0/detJ)*(J[0]*(-3.0) + J[1]*3.0)) + dof_values[16]*((1.0/detJ)*(J[0]*3.0 + J[1]*(-3.0)));
 
15445
    vertex_values[13] = dof_values[8]*(1.0/detJ)*J[1] + dof_values[9]*((1.0/detJ)*(J[1]*(-3.0))) + dof_values[10]*(1.0/detJ)*J[1]*3.0 + dof_values[11]*((1.0/detJ)*(J[0] + J[1]*(-1.0))) + dof_values[12]*((1.0/detJ)*(J[0]*(-3.0) + J[1]*3.0)) + dof_values[13]*((1.0/detJ)*(J[0]*3.0 + J[1]*(-3.0)));
 
15446
    vertex_values[4] = dof_values[11]*(1.0/detJ)*J[2]*3.0 + dof_values[12]*((1.0/detJ)*(J[2]*(-3.0))) + dof_values[13]*(1.0/detJ)*J[2] + dof_values[14]*((1.0/detJ)*(J[3]*(-3.0))) + dof_values[15]*(1.0/detJ)*J[3]*3.0 + dof_values[16]*((1.0/detJ)*(J[3]*(-1.0)));
 
15447
    vertex_values[9] = dof_values[8]*(1.0/detJ)*J[2]*3.0 + dof_values[9]*((1.0/detJ)*(J[2]*(-3.0))) + dof_values[10]*(1.0/detJ)*J[2] + dof_values[14]*((1.0/detJ)*(J[2] + J[3]*(-1.0))) + dof_values[15]*((1.0/detJ)*(J[2]*(-3.0) + J[3]*3.0)) + dof_values[16]*((1.0/detJ)*(J[2]*3.0 + J[3]*(-3.0)));
 
15448
    vertex_values[14] = dof_values[8]*(1.0/detJ)*J[3] + dof_values[9]*((1.0/detJ)*(J[3]*(-3.0))) + dof_values[10]*(1.0/detJ)*J[3]*3.0 + dof_values[11]*((1.0/detJ)*(J[2] + J[3]*(-1.0))) + dof_values[12]*((1.0/detJ)*(J[2]*(-3.0) + J[3]*3.0)) + dof_values[13]*((1.0/detJ)*(J[2]*3.0 + J[3]*(-3.0)));
15171
15449
  }
15172
15450
 
15173
15451
  /// Map coordinate xhat from reference cell to coordinate x in cell
15175
15453
                                       const double* xhat,
15176
15454
                                       const ufc::cell& c) const
15177
15455
  {
15178
 
    std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented (introduced in UFC 2.0)." << std::endl;
 
15456
    std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented." << std::endl;
15179
15457
  }
15180
15458
 
15181
15459
  /// Map from coordinate x in cell to coordinate xhat in reference cell
15183
15461
                                     const double* x,
15184
15462
                                     const ufc::cell& c) const
15185
15463
  {
15186
 
    std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented (introduced in UFC 2.0)." << std::endl;
 
15464
    std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented." << std::endl;
15187
15465
  }
15188
15466
 
15189
15467
  /// Return the number of sub elements (for a mixed element)
15190
 
  virtual unsigned int num_sub_elements() const
 
15468
  virtual std::size_t num_sub_elements() const
15191
15469
  {
15192
15470
    return 2;
15193
15471
  }
15194
15472
 
15195
15473
  /// Create a new finite element for sub element i (for a mixed element)
15196
 
  virtual ufc::finite_element* create_sub_element(unsigned int i) const
 
15474
  virtual ufc::finite_element* create_sub_element(std::size_t i) const
15197
15475
  {
15198
15476
    switch (i)
15199
15477
    {
15225
15503
 
15226
15504
class mixedmixedelement_dofmap_0: public ufc::dofmap
15227
15505
{
15228
 
private:
15229
 
 
15230
 
  unsigned int _global_dimension;
15231
15506
public:
15232
15507
 
15233
15508
  /// Constructor
15234
15509
  mixedmixedelement_dofmap_0() : ufc::dofmap()
15235
15510
  {
15236
 
    _global_dimension = 0;
 
15511
    // Do nothing
15237
15512
  }
15238
15513
 
15239
15514
  /// Destructor
15245
15520
  /// Return a string identifying the dofmap
15246
15521
  virtual const char* signature() const
15247
15522
  {
15248
 
    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', Cell('triangle', Space(2)), 0, None)";
 
15523
    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 0, None)";
15249
15524
  }
15250
15525
 
15251
15526
  /// Return true iff mesh entities of topological dimension d are needed
15252
 
  virtual bool needs_mesh_entities(unsigned int d) const
 
15527
  virtual bool needs_mesh_entities(std::size_t d) const
15253
15528
  {
15254
15529
    switch (d)
15255
15530
    {
15273
15548
    return false;
15274
15549
  }
15275
15550
 
15276
 
  /// Initialize dofmap for mesh (return true iff init_cell() is needed)
15277
 
  virtual bool init_mesh(const ufc::mesh& m)
15278
 
  {
15279
 
    _global_dimension = m.num_entities[2];
15280
 
    return false;
15281
 
  }
15282
 
 
15283
 
  /// Initialize dofmap for given cell
15284
 
  virtual void init_cell(const ufc::mesh& m,
15285
 
                         const ufc::cell& c)
15286
 
  {
15287
 
    // Do nothing
15288
 
  }
15289
 
 
15290
 
  /// Finish initialization of dofmap for cells
15291
 
  virtual void init_cell_finalize()
15292
 
  {
15293
 
    // Do nothing
15294
 
  }
15295
 
 
15296
15551
  /// Return the topological dimension of the associated cell shape
15297
 
  virtual unsigned int topological_dimension() const
 
15552
  virtual std::size_t topological_dimension() const
15298
15553
  {
15299
15554
    return 2;
15300
15555
  }
15301
15556
 
15302
15557
  /// Return the geometric dimension of the associated cell shape
15303
 
  virtual unsigned int geometric_dimension() const
 
15558
  virtual std::size_t geometric_dimension() const
15304
15559
  {
15305
15560
    return 2;
15306
15561
  }
15307
15562
 
15308
15563
  /// Return the dimension of the global finite element function space
15309
 
  virtual unsigned int global_dimension() const
 
15564
  virtual std::size_t global_dimension(const std::vector<std::size_t>&
 
15565
                                       num_global_entities) const
15310
15566
  {
15311
 
    return _global_dimension;
 
15567
    return num_global_entities[2];
15312
15568
  }
15313
15569
 
15314
15570
  /// Return the dimension of the local finite element function space for a cell
15315
 
  virtual unsigned int local_dimension(const ufc::cell& c) const
 
15571
  virtual std::size_t local_dimension(const ufc::cell& c) const
15316
15572
  {
15317
15573
    return 1;
15318
15574
  }
15319
15575
 
15320
15576
  /// Return the maximum dimension of the local finite element function space
15321
 
  virtual unsigned int max_local_dimension() const
 
15577
  virtual std::size_t max_local_dimension() const
15322
15578
  {
15323
15579
    return 1;
15324
15580
  }
15325
15581
 
15326
15582
  /// Return the number of dofs on each cell facet
15327
 
  virtual unsigned int num_facet_dofs() const
 
15583
  virtual std::size_t num_facet_dofs() const
15328
15584
  {
15329
15585
    return 0;
15330
15586
  }
15331
15587
 
15332
15588
  /// Return the number of dofs associated with each cell entity of dimension d
15333
 
  virtual unsigned int num_entity_dofs(unsigned int d) const
 
15589
  virtual std::size_t num_entity_dofs(std::size_t d) const
15334
15590
  {
15335
15591
    switch (d)
15336
15592
    {
15355
15611
  }
15356
15612
 
15357
15613
  /// Tabulate the local-to-global mapping of dofs on a cell
15358
 
  virtual void tabulate_dofs(unsigned int* dofs,
15359
 
                             const ufc::mesh& m,
 
15614
  virtual void tabulate_dofs(std::size_t* dofs,
 
15615
                             const std::vector<std::size_t>& num_global_entities,
15360
15616
                             const ufc::cell& c) const
15361
15617
  {
15362
15618
    dofs[0] = c.entity_indices[2][0];
15363
15619
  }
15364
15620
 
15365
15621
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
15366
 
  virtual void tabulate_facet_dofs(unsigned int* dofs,
15367
 
                                   unsigned int facet) const
 
15622
  virtual void tabulate_facet_dofs(std::size_t* dofs,
 
15623
                                   std::size_t facet) const
15368
15624
  {
15369
15625
    switch (facet)
15370
15626
    {
15388
15644
  }
15389
15645
 
15390
15646
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
15391
 
  virtual void tabulate_entity_dofs(unsigned int* dofs,
15392
 
                                    unsigned int d, unsigned int i) const
 
15647
  virtual void tabulate_entity_dofs(std::size_t* dofs,
 
15648
                                    std::size_t d, std::size_t i) const
15393
15649
  {
15394
15650
    if (d > 2)
15395
15651
    {
15423
15679
  }
15424
15680
 
15425
15681
  /// Tabulate the coordinates of all dofs on a cell
15426
 
  virtual void tabulate_coordinates(double** coordinates,
15427
 
                                    const ufc::cell& c) const
 
15682
  virtual void tabulate_coordinates(double** dof_coordinates,
 
15683
                                    const double* vertex_coordinates) const
15428
15684
  {
15429
 
    const double * const * x = c.coordinates;
15430
 
    
15431
 
    coordinates[0][0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
15432
 
    coordinates[0][1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
15685
    dof_coordinates[0][0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
15686
    dof_coordinates[0][1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
15433
15687
  }
15434
15688
 
15435
15689
  /// Return the number of sub dofmaps (for a mixed element)
15436
 
  virtual unsigned int num_sub_dofmaps() const
 
15690
  virtual std::size_t num_sub_dofmaps() const
15437
15691
  {
15438
15692
    return 0;
15439
15693
  }
15440
15694
 
15441
15695
  /// Create a new dofmap for sub dofmap i (for a mixed element)
15442
 
  virtual ufc::dofmap* create_sub_dofmap(unsigned int i) const
 
15696
  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
15443
15697
  {
15444
15698
    return 0;
15445
15699
  }
15457
15711
 
15458
15712
class mixedmixedelement_dofmap_1: public ufc::dofmap
15459
15713
{
15460
 
private:
15461
 
 
15462
 
  unsigned int _global_dimension;
15463
15714
public:
15464
15715
 
15465
15716
  /// Constructor
15466
15717
  mixedmixedelement_dofmap_1() : ufc::dofmap()
15467
15718
  {
15468
 
    _global_dimension = 0;
 
15719
    // Do nothing
15469
15720
  }
15470
15721
 
15471
15722
  /// Destructor
15477
15728
  /// Return a string identifying the dofmap
15478
15729
  virtual const char* signature() const
15479
15730
  {
15480
 
    return "FFC dofmap for VectorElement('Discontinuous Lagrange', Cell('triangle', Space(2)), 0, 2, None)";
 
15731
    return "FFC dofmap for VectorElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 0, 2, None)";
15481
15732
  }
15482
15733
 
15483
15734
  /// Return true iff mesh entities of topological dimension d are needed
15484
 
  virtual bool needs_mesh_entities(unsigned int d) const
 
15735
  virtual bool needs_mesh_entities(std::size_t d) const
15485
15736
  {
15486
15737
    switch (d)
15487
15738
    {
15505
15756
    return false;
15506
15757
  }
15507
15758
 
15508
 
  /// Initialize dofmap for mesh (return true iff init_cell() is needed)
15509
 
  virtual bool init_mesh(const ufc::mesh& m)
15510
 
  {
15511
 
    _global_dimension = 2*m.num_entities[2];
15512
 
    return false;
15513
 
  }
15514
 
 
15515
 
  /// Initialize dofmap for given cell
15516
 
  virtual void init_cell(const ufc::mesh& m,
15517
 
                         const ufc::cell& c)
15518
 
  {
15519
 
    // Do nothing
15520
 
  }
15521
 
 
15522
 
  /// Finish initialization of dofmap for cells
15523
 
  virtual void init_cell_finalize()
15524
 
  {
15525
 
    // Do nothing
15526
 
  }
15527
 
 
15528
15759
  /// Return the topological dimension of the associated cell shape
15529
 
  virtual unsigned int topological_dimension() const
 
15760
  virtual std::size_t topological_dimension() const
15530
15761
  {
15531
15762
    return 2;
15532
15763
  }
15533
15764
 
15534
15765
  /// Return the geometric dimension of the associated cell shape
15535
 
  virtual unsigned int geometric_dimension() const
 
15766
  virtual std::size_t geometric_dimension() const
15536
15767
  {
15537
15768
    return 2;
15538
15769
  }
15539
15770
 
15540
15771
  /// Return the dimension of the global finite element function space
15541
 
  virtual unsigned int global_dimension() const
 
15772
  virtual std::size_t global_dimension(const std::vector<std::size_t>&
 
15773
                                       num_global_entities) const
15542
15774
  {
15543
 
    return _global_dimension;
 
15775
    return 2*num_global_entities[2];
15544
15776
  }
15545
15777
 
15546
15778
  /// Return the dimension of the local finite element function space for a cell
15547
 
  virtual unsigned int local_dimension(const ufc::cell& c) const
 
15779
  virtual std::size_t local_dimension(const ufc::cell& c) const
15548
15780
  {
15549
15781
    return 2;
15550
15782
  }
15551
15783
 
15552
15784
  /// Return the maximum dimension of the local finite element function space
15553
 
  virtual unsigned int max_local_dimension() const
 
15785
  virtual std::size_t max_local_dimension() const
15554
15786
  {
15555
15787
    return 2;
15556
15788
  }
15557
15789
 
15558
15790
  /// Return the number of dofs on each cell facet
15559
 
  virtual unsigned int num_facet_dofs() const
 
15791
  virtual std::size_t num_facet_dofs() const
15560
15792
  {
15561
15793
    return 0;
15562
15794
  }
15563
15795
 
15564
15796
  /// Return the number of dofs associated with each cell entity of dimension d
15565
 
  virtual unsigned int num_entity_dofs(unsigned int d) const
 
15797
  virtual std::size_t num_entity_dofs(std::size_t d) const
15566
15798
  {
15567
15799
    switch (d)
15568
15800
    {
15587
15819
  }
15588
15820
 
15589
15821
  /// Tabulate the local-to-global mapping of dofs on a cell
15590
 
  virtual void tabulate_dofs(unsigned int* dofs,
15591
 
                             const ufc::mesh& m,
 
15822
  virtual void tabulate_dofs(std::size_t* dofs,
 
15823
                             const std::vector<std::size_t>& num_global_entities,
15592
15824
                             const ufc::cell& c) const
15593
15825
  {
15594
15826
    unsigned int offset = 0;
15595
15827
    dofs[0] = offset + c.entity_indices[2][0];
15596
 
    offset += m.num_entities[2];
 
15828
    offset += num_global_entities[2];
15597
15829
    dofs[1] = offset + c.entity_indices[2][0];
15598
 
    offset += m.num_entities[2];
 
15830
    offset += num_global_entities[2];
15599
15831
  }
15600
15832
 
15601
15833
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
15602
 
  virtual void tabulate_facet_dofs(unsigned int* dofs,
15603
 
                                   unsigned int facet) const
 
15834
  virtual void tabulate_facet_dofs(std::size_t* dofs,
 
15835
                                   std::size_t facet) const
15604
15836
  {
15605
15837
    switch (facet)
15606
15838
    {
15624
15856
  }
15625
15857
 
15626
15858
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
15627
 
  virtual void tabulate_entity_dofs(unsigned int* dofs,
15628
 
                                    unsigned int d, unsigned int i) const
 
15859
  virtual void tabulate_entity_dofs(std::size_t* dofs,
 
15860
                                    std::size_t d, std::size_t i) const
15629
15861
  {
15630
15862
    if (d > 2)
15631
15863
    {
15660
15892
  }
15661
15893
 
15662
15894
  /// Tabulate the coordinates of all dofs on a cell
15663
 
  virtual void tabulate_coordinates(double** coordinates,
15664
 
                                    const ufc::cell& c) const
 
15895
  virtual void tabulate_coordinates(double** dof_coordinates,
 
15896
                                    const double* vertex_coordinates) const
15665
15897
  {
15666
 
    const double * const * x = c.coordinates;
15667
 
    
15668
 
    coordinates[0][0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
15669
 
    coordinates[0][1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
15670
 
    coordinates[1][0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
15671
 
    coordinates[1][1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
 
15898
    dof_coordinates[0][0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
15899
    dof_coordinates[0][1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
 
15900
    dof_coordinates[1][0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
15901
    dof_coordinates[1][1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
15672
15902
  }
15673
15903
 
15674
15904
  /// Return the number of sub dofmaps (for a mixed element)
15675
 
  virtual unsigned int num_sub_dofmaps() const
 
15905
  virtual std::size_t num_sub_dofmaps() const
15676
15906
  {
15677
15907
    return 2;
15678
15908
  }
15679
15909
 
15680
15910
  /// Create a new dofmap for sub dofmap i (for a mixed element)
15681
 
  virtual ufc::dofmap* create_sub_dofmap(unsigned int i) const
 
15911
  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
15682
15912
  {
15683
15913
    switch (i)
15684
15914
    {
15710
15940
 
15711
15941
class mixedmixedelement_dofmap_2: public ufc::dofmap
15712
15942
{
15713
 
private:
15714
 
 
15715
 
  unsigned int _global_dimension;
15716
15943
public:
15717
15944
 
15718
15945
  /// Constructor
15719
15946
  mixedmixedelement_dofmap_2() : ufc::dofmap()
15720
15947
  {
15721
 
    _global_dimension = 0;
 
15948
    // Do nothing
15722
15949
  }
15723
15950
 
15724
15951
  /// Destructor
15730
15957
  /// Return a string identifying the dofmap
15731
15958
  virtual const char* signature() const
15732
15959
  {
15733
 
    return "FFC dofmap for FiniteElement('Lagrange', Cell('triangle', Space(2)), 2, None)";
 
15960
    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 2, None)";
15734
15961
  }
15735
15962
 
15736
15963
  /// Return true iff mesh entities of topological dimension d are needed
15737
 
  virtual bool needs_mesh_entities(unsigned int d) const
 
15964
  virtual bool needs_mesh_entities(std::size_t d) const
15738
15965
  {
15739
15966
    switch (d)
15740
15967
    {
15758
15985
    return false;
15759
15986
  }
15760
15987
 
15761
 
  /// Initialize dofmap for mesh (return true iff init_cell() is needed)
15762
 
  virtual bool init_mesh(const ufc::mesh& m)
15763
 
  {
15764
 
    _global_dimension = m.num_entities[0] + m.num_entities[1];
15765
 
    return false;
15766
 
  }
15767
 
 
15768
 
  /// Initialize dofmap for given cell
15769
 
  virtual void init_cell(const ufc::mesh& m,
15770
 
                         const ufc::cell& c)
15771
 
  {
15772
 
    // Do nothing
15773
 
  }
15774
 
 
15775
 
  /// Finish initialization of dofmap for cells
15776
 
  virtual void init_cell_finalize()
15777
 
  {
15778
 
    // Do nothing
15779
 
  }
15780
 
 
15781
15988
  /// Return the topological dimension of the associated cell shape
15782
 
  virtual unsigned int topological_dimension() const
 
15989
  virtual std::size_t topological_dimension() const
15783
15990
  {
15784
15991
    return 2;
15785
15992
  }
15786
15993
 
15787
15994
  /// Return the geometric dimension of the associated cell shape
15788
 
  virtual unsigned int geometric_dimension() const
 
15995
  virtual std::size_t geometric_dimension() const
15789
15996
  {
15790
15997
    return 2;
15791
15998
  }
15792
15999
 
15793
16000
  /// Return the dimension of the global finite element function space
15794
 
  virtual unsigned int global_dimension() const
 
16001
  virtual std::size_t global_dimension(const std::vector<std::size_t>&
 
16002
                                       num_global_entities) const
15795
16003
  {
15796
 
    return _global_dimension;
 
16004
    return num_global_entities[0] + num_global_entities[1];
15797
16005
  }
15798
16006
 
15799
16007
  /// Return the dimension of the local finite element function space for a cell
15800
 
  virtual unsigned int local_dimension(const ufc::cell& c) const
 
16008
  virtual std::size_t local_dimension(const ufc::cell& c) const
15801
16009
  {
15802
16010
    return 6;
15803
16011
  }
15804
16012
 
15805
16013
  /// Return the maximum dimension of the local finite element function space
15806
 
  virtual unsigned int max_local_dimension() const
 
16014
  virtual std::size_t max_local_dimension() const
15807
16015
  {
15808
16016
    return 6;
15809
16017
  }
15810
16018
 
15811
16019
  /// Return the number of dofs on each cell facet
15812
 
  virtual unsigned int num_facet_dofs() const
 
16020
  virtual std::size_t num_facet_dofs() const
15813
16021
  {
15814
16022
    return 3;
15815
16023
  }
15816
16024
 
15817
16025
  /// Return the number of dofs associated with each cell entity of dimension d
15818
 
  virtual unsigned int num_entity_dofs(unsigned int d) const
 
16026
  virtual std::size_t num_entity_dofs(std::size_t d) const
15819
16027
  {
15820
16028
    switch (d)
15821
16029
    {
15840
16048
  }
15841
16049
 
15842
16050
  /// Tabulate the local-to-global mapping of dofs on a cell
15843
 
  virtual void tabulate_dofs(unsigned int* dofs,
15844
 
                             const ufc::mesh& m,
 
16051
  virtual void tabulate_dofs(std::size_t* dofs,
 
16052
                             const std::vector<std::size_t>& num_global_entities,
15845
16053
                             const ufc::cell& c) const
15846
16054
  {
15847
16055
    unsigned int offset = 0;
15848
16056
    dofs[0] = offset + c.entity_indices[0][0];
15849
16057
    dofs[1] = offset + c.entity_indices[0][1];
15850
16058
    dofs[2] = offset + c.entity_indices[0][2];
15851
 
    offset += m.num_entities[0];
 
16059
    offset += num_global_entities[0];
15852
16060
    dofs[3] = offset + c.entity_indices[1][0];
15853
16061
    dofs[4] = offset + c.entity_indices[1][1];
15854
16062
    dofs[5] = offset + c.entity_indices[1][2];
15855
 
    offset += m.num_entities[1];
 
16063
    offset += num_global_entities[1];
15856
16064
  }
15857
16065
 
15858
16066
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
15859
 
  virtual void tabulate_facet_dofs(unsigned int* dofs,
15860
 
                                   unsigned int facet) const
 
16067
  virtual void tabulate_facet_dofs(std::size_t* dofs,
 
16068
                                   std::size_t facet) const
15861
16069
  {
15862
16070
    switch (facet)
15863
16071
    {
15887
16095
  }
15888
16096
 
15889
16097
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
15890
 
  virtual void tabulate_entity_dofs(unsigned int* dofs,
15891
 
                                    unsigned int d, unsigned int i) const
 
16098
  virtual void tabulate_entity_dofs(std::size_t* dofs,
 
16099
                                    std::size_t d, std::size_t i) const
15892
16100
  {
15893
16101
    if (d > 2)
15894
16102
    {
15963
16171
  }
15964
16172
 
15965
16173
  /// Tabulate the coordinates of all dofs on a cell
15966
 
  virtual void tabulate_coordinates(double** coordinates,
15967
 
                                    const ufc::cell& c) const
 
16174
  virtual void tabulate_coordinates(double** dof_coordinates,
 
16175
                                    const double* vertex_coordinates) const
15968
16176
  {
15969
 
    const double * const * x = c.coordinates;
15970
 
    
15971
 
    coordinates[0][0] = x[0][0];
15972
 
    coordinates[0][1] = x[0][1];
15973
 
    coordinates[1][0] = x[1][0];
15974
 
    coordinates[1][1] = x[1][1];
15975
 
    coordinates[2][0] = x[2][0];
15976
 
    coordinates[2][1] = x[2][1];
15977
 
    coordinates[3][0] = 0.5*x[1][0] + 0.5*x[2][0];
15978
 
    coordinates[3][1] = 0.5*x[1][1] + 0.5*x[2][1];
15979
 
    coordinates[4][0] = 0.5*x[0][0] + 0.5*x[2][0];
15980
 
    coordinates[4][1] = 0.5*x[0][1] + 0.5*x[2][1];
15981
 
    coordinates[5][0] = 0.5*x[0][0] + 0.5*x[1][0];
15982
 
    coordinates[5][1] = 0.5*x[0][1] + 0.5*x[1][1];
 
16177
    dof_coordinates[0][0] = vertex_coordinates[0];
 
16178
    dof_coordinates[0][1] = vertex_coordinates[1];
 
16179
    dof_coordinates[1][0] = vertex_coordinates[2];
 
16180
    dof_coordinates[1][1] = vertex_coordinates[3];
 
16181
    dof_coordinates[2][0] = vertex_coordinates[4];
 
16182
    dof_coordinates[2][1] = vertex_coordinates[5];
 
16183
    dof_coordinates[3][0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
16184
    dof_coordinates[3][1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
 
16185
    dof_coordinates[4][0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
 
16186
    dof_coordinates[4][1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
 
16187
    dof_coordinates[5][0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
 
16188
    dof_coordinates[5][1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
15983
16189
  }
15984
16190
 
15985
16191
  /// Return the number of sub dofmaps (for a mixed element)
15986
 
  virtual unsigned int num_sub_dofmaps() const
 
16192
  virtual std::size_t num_sub_dofmaps() const
15987
16193
  {
15988
16194
    return 0;
15989
16195
  }
15990
16196
 
15991
16197
  /// Create a new dofmap for sub dofmap i (for a mixed element)
15992
 
  virtual ufc::dofmap* create_sub_dofmap(unsigned int i) const
 
16198
  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
15993
16199
  {
15994
16200
    return 0;
15995
16201
  }
16007
16213
 
16008
16214
class mixedmixedelement_dofmap_3: public ufc::dofmap
16009
16215
{
16010
 
private:
16011
 
 
16012
 
  unsigned int _global_dimension;
16013
16216
public:
16014
16217
 
16015
16218
  /// Constructor
16016
16219
  mixedmixedelement_dofmap_3() : ufc::dofmap()
16017
16220
  {
16018
 
    _global_dimension = 0;
 
16221
    // Do nothing
16019
16222
  }
16020
16223
 
16021
16224
  /// Destructor
16027
16230
  /// Return a string identifying the dofmap
16028
16231
  virtual const char* signature() const
16029
16232
  {
16030
 
    return "FFC dofmap for MixedElement(*[VectorElement('Discontinuous Lagrange', Cell('triangle', Space(2)), 0, 2, None), FiniteElement('Lagrange', Cell('triangle', Space(2)), 2, None)], **{'value_shape': (3,) })";
 
16233
    return "FFC dofmap for MixedElement(*[VectorElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 0, 2, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 2, None)], **{'value_shape': (3,) })";
16031
16234
  }
16032
16235
 
16033
16236
  /// Return true iff mesh entities of topological dimension d are needed
16034
 
  virtual bool needs_mesh_entities(unsigned int d) const
 
16237
  virtual bool needs_mesh_entities(std::size_t d) const
16035
16238
  {
16036
16239
    switch (d)
16037
16240
    {
16055
16258
    return false;
16056
16259
  }
16057
16260
 
16058
 
  /// Initialize dofmap for mesh (return true iff init_cell() is needed)
16059
 
  virtual bool init_mesh(const ufc::mesh& m)
16060
 
  {
16061
 
    _global_dimension = m.num_entities[0] + m.num_entities[1] + 2*m.num_entities[2];
16062
 
    return false;
16063
 
  }
16064
 
 
16065
 
  /// Initialize dofmap for given cell
16066
 
  virtual void init_cell(const ufc::mesh& m,
16067
 
                         const ufc::cell& c)
16068
 
  {
16069
 
    // Do nothing
16070
 
  }
16071
 
 
16072
 
  /// Finish initialization of dofmap for cells
16073
 
  virtual void init_cell_finalize()
16074
 
  {
16075
 
    // Do nothing
16076
 
  }
16077
 
 
16078
16261
  /// Return the topological dimension of the associated cell shape
16079
 
  virtual unsigned int topological_dimension() const
 
16262
  virtual std::size_t topological_dimension() const
16080
16263
  {
16081
16264
    return 2;
16082
16265
  }
16083
16266
 
16084
16267
  /// Return the geometric dimension of the associated cell shape
16085
 
  virtual unsigned int geometric_dimension() const
 
16268
  virtual std::size_t geometric_dimension() const
16086
16269
  {
16087
16270
    return 2;
16088
16271
  }
16089
16272
 
16090
16273
  /// Return the dimension of the global finite element function space
16091
 
  virtual unsigned int global_dimension() const
 
16274
  virtual std::size_t global_dimension(const std::vector<std::size_t>&
 
16275
                                       num_global_entities) const
16092
16276
  {
16093
 
    return _global_dimension;
 
16277
    return num_global_entities[0] + num_global_entities[1] + 2*num_global_entities[2];
16094
16278
  }
16095
16279
 
16096
16280
  /// Return the dimension of the local finite element function space for a cell
16097
 
  virtual unsigned int local_dimension(const ufc::cell& c) const
 
16281
  virtual std::size_t local_dimension(const ufc::cell& c) const
16098
16282
  {
16099
16283
    return 8;
16100
16284
  }
16101
16285
 
16102
16286
  /// Return the maximum dimension of the local finite element function space
16103
 
  virtual unsigned int max_local_dimension() const
 
16287
  virtual std::size_t max_local_dimension() const
16104
16288
  {
16105
16289
    return 8;
16106
16290
  }
16107
16291
 
16108
16292
  /// Return the number of dofs on each cell facet
16109
 
  virtual unsigned int num_facet_dofs() const
 
16293
  virtual std::size_t num_facet_dofs() const
16110
16294
  {
16111
16295
    return 3;
16112
16296
  }
16113
16297
 
16114
16298
  /// Return the number of dofs associated with each cell entity of dimension d
16115
 
  virtual unsigned int num_entity_dofs(unsigned int d) const
 
16299
  virtual std::size_t num_entity_dofs(std::size_t d) const
16116
16300
  {
16117
16301
    switch (d)
16118
16302
    {
16137
16321
  }
16138
16322
 
16139
16323
  /// Tabulate the local-to-global mapping of dofs on a cell
16140
 
  virtual void tabulate_dofs(unsigned int* dofs,
16141
 
                             const ufc::mesh& m,
 
16324
  virtual void tabulate_dofs(std::size_t* dofs,
 
16325
                             const std::vector<std::size_t>& num_global_entities,
16142
16326
                             const ufc::cell& c) const
16143
16327
  {
16144
16328
    unsigned int offset = 0;
16145
16329
    dofs[0] = offset + c.entity_indices[2][0];
16146
 
    offset += m.num_entities[2];
 
16330
    offset += num_global_entities[2];
16147
16331
    dofs[1] = offset + c.entity_indices[2][0];
16148
 
    offset += m.num_entities[2];
 
16332
    offset += num_global_entities[2];
16149
16333
    dofs[2] = offset + c.entity_indices[0][0];
16150
16334
    dofs[3] = offset + c.entity_indices[0][1];
16151
16335
    dofs[4] = offset + c.entity_indices[0][2];
16152
 
    offset += m.num_entities[0];
 
16336
    offset += num_global_entities[0];
16153
16337
    dofs[5] = offset + c.entity_indices[1][0];
16154
16338
    dofs[6] = offset + c.entity_indices[1][1];
16155
16339
    dofs[7] = offset + c.entity_indices[1][2];
16156
 
    offset += m.num_entities[1];
 
16340
    offset += num_global_entities[1];
16157
16341
  }
16158
16342
 
16159
16343
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
16160
 
  virtual void tabulate_facet_dofs(unsigned int* dofs,
16161
 
                                   unsigned int facet) const
 
16344
  virtual void tabulate_facet_dofs(std::size_t* dofs,
 
16345
                                   std::size_t facet) const
16162
16346
  {
16163
16347
    switch (facet)
16164
16348
    {
16188
16372
  }
16189
16373
 
16190
16374
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
16191
 
  virtual void tabulate_entity_dofs(unsigned int* dofs,
16192
 
                                    unsigned int d, unsigned int i) const
 
16375
  virtual void tabulate_entity_dofs(std::size_t* dofs,
 
16376
                                    std::size_t d, std::size_t i) const
16193
16377
  {
16194
16378
    if (d > 2)
16195
16379
    {
16270
16454
  }
16271
16455
 
16272
16456
  /// Tabulate the coordinates of all dofs on a cell
16273
 
  virtual void tabulate_coordinates(double** coordinates,
16274
 
                                    const ufc::cell& c) const
 
16457
  virtual void tabulate_coordinates(double** dof_coordinates,
 
16458
                                    const double* vertex_coordinates) const
16275
16459
  {
16276
 
    const double * const * x = c.coordinates;
16277
 
    
16278
 
    coordinates[0][0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
16279
 
    coordinates[0][1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
16280
 
    coordinates[1][0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
16281
 
    coordinates[1][1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
16282
 
    coordinates[2][0] = x[0][0];
16283
 
    coordinates[2][1] = x[0][1];
16284
 
    coordinates[3][0] = x[1][0];
16285
 
    coordinates[3][1] = x[1][1];
16286
 
    coordinates[4][0] = x[2][0];
16287
 
    coordinates[4][1] = x[2][1];
16288
 
    coordinates[5][0] = 0.5*x[1][0] + 0.5*x[2][0];
16289
 
    coordinates[5][1] = 0.5*x[1][1] + 0.5*x[2][1];
16290
 
    coordinates[6][0] = 0.5*x[0][0] + 0.5*x[2][0];
16291
 
    coordinates[6][1] = 0.5*x[0][1] + 0.5*x[2][1];
16292
 
    coordinates[7][0] = 0.5*x[0][0] + 0.5*x[1][0];
16293
 
    coordinates[7][1] = 0.5*x[0][1] + 0.5*x[1][1];
 
16460
    dof_coordinates[0][0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
16461
    dof_coordinates[0][1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
 
16462
    dof_coordinates[1][0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
16463
    dof_coordinates[1][1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
 
16464
    dof_coordinates[2][0] = vertex_coordinates[0];
 
16465
    dof_coordinates[2][1] = vertex_coordinates[1];
 
16466
    dof_coordinates[3][0] = vertex_coordinates[2];
 
16467
    dof_coordinates[3][1] = vertex_coordinates[3];
 
16468
    dof_coordinates[4][0] = vertex_coordinates[4];
 
16469
    dof_coordinates[4][1] = vertex_coordinates[5];
 
16470
    dof_coordinates[5][0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
16471
    dof_coordinates[5][1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
 
16472
    dof_coordinates[6][0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
 
16473
    dof_coordinates[6][1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
 
16474
    dof_coordinates[7][0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
 
16475
    dof_coordinates[7][1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
16294
16476
  }
16295
16477
 
16296
16478
  /// Return the number of sub dofmaps (for a mixed element)
16297
 
  virtual unsigned int num_sub_dofmaps() const
 
16479
  virtual std::size_t num_sub_dofmaps() const
16298
16480
  {
16299
16481
    return 2;
16300
16482
  }
16301
16483
 
16302
16484
  /// Create a new dofmap for sub dofmap i (for a mixed element)
16303
 
  virtual ufc::dofmap* create_sub_dofmap(unsigned int i) const
 
16485
  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
16304
16486
  {
16305
16487
    switch (i)
16306
16488
    {
16332
16514
 
16333
16515
class mixedmixedelement_dofmap_4: public ufc::dofmap
16334
16516
{
16335
 
private:
16336
 
 
16337
 
  unsigned int _global_dimension;
16338
16517
public:
16339
16518
 
16340
16519
  /// Constructor
16341
16520
  mixedmixedelement_dofmap_4() : ufc::dofmap()
16342
16521
  {
16343
 
    _global_dimension = 0;
 
16522
    // Do nothing
16344
16523
  }
16345
16524
 
16346
16525
  /// Destructor
16352
16531
  /// Return a string identifying the dofmap
16353
16532
  virtual const char* signature() const
16354
16533
  {
16355
 
    return "FFC dofmap for FiniteElement('Raviart-Thomas', Cell('triangle', Space(2)), 3, None)";
 
16534
    return "FFC dofmap for FiniteElement('Raviart-Thomas', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 3, None)";
16356
16535
  }
16357
16536
 
16358
16537
  /// Return true iff mesh entities of topological dimension d are needed
16359
 
  virtual bool needs_mesh_entities(unsigned int d) const
 
16538
  virtual bool needs_mesh_entities(std::size_t d) const
16360
16539
  {
16361
16540
    switch (d)
16362
16541
    {
16380
16559
    return false;
16381
16560
  }
16382
16561
 
16383
 
  /// Initialize dofmap for mesh (return true iff init_cell() is needed)
16384
 
  virtual bool init_mesh(const ufc::mesh& m)
16385
 
  {
16386
 
    _global_dimension = 3*m.num_entities[1] + 6*m.num_entities[2];
16387
 
    return false;
16388
 
  }
16389
 
 
16390
 
  /// Initialize dofmap for given cell
16391
 
  virtual void init_cell(const ufc::mesh& m,
16392
 
                         const ufc::cell& c)
16393
 
  {
16394
 
    // Do nothing
16395
 
  }
16396
 
 
16397
 
  /// Finish initialization of dofmap for cells
16398
 
  virtual void init_cell_finalize()
16399
 
  {
16400
 
    // Do nothing
16401
 
  }
16402
 
 
16403
16562
  /// Return the topological dimension of the associated cell shape
16404
 
  virtual unsigned int topological_dimension() const
 
16563
  virtual std::size_t topological_dimension() const
16405
16564
  {
16406
16565
    return 2;
16407
16566
  }
16408
16567
 
16409
16568
  /// Return the geometric dimension of the associated cell shape
16410
 
  virtual unsigned int geometric_dimension() const
 
16569
  virtual std::size_t geometric_dimension() const
16411
16570
  {
16412
16571
    return 2;
16413
16572
  }
16414
16573
 
16415
16574
  /// Return the dimension of the global finite element function space
16416
 
  virtual unsigned int global_dimension() const
 
16575
  virtual std::size_t global_dimension(const std::vector<std::size_t>&
 
16576
                                       num_global_entities) const
16417
16577
  {
16418
 
    return _global_dimension;
 
16578
    return 3*num_global_entities[1] + 6*num_global_entities[2];
16419
16579
  }
16420
16580
 
16421
16581
  /// Return the dimension of the local finite element function space for a cell
16422
 
  virtual unsigned int local_dimension(const ufc::cell& c) const
 
16582
  virtual std::size_t local_dimension(const ufc::cell& c) const
16423
16583
  {
16424
16584
    return 15;
16425
16585
  }
16426
16586
 
16427
16587
  /// Return the maximum dimension of the local finite element function space
16428
 
  virtual unsigned int max_local_dimension() const
 
16588
  virtual std::size_t max_local_dimension() const
16429
16589
  {
16430
16590
    return 15;
16431
16591
  }
16432
16592
 
16433
16593
  /// Return the number of dofs on each cell facet
16434
 
  virtual unsigned int num_facet_dofs() const
 
16594
  virtual std::size_t num_facet_dofs() const
16435
16595
  {
16436
16596
    return 3;
16437
16597
  }
16438
16598
 
16439
16599
  /// Return the number of dofs associated with each cell entity of dimension d
16440
 
  virtual unsigned int num_entity_dofs(unsigned int d) const
 
16600
  virtual std::size_t num_entity_dofs(std::size_t d) const
16441
16601
  {
16442
16602
    switch (d)
16443
16603
    {
16462
16622
  }
16463
16623
 
16464
16624
  /// Tabulate the local-to-global mapping of dofs on a cell
16465
 
  virtual void tabulate_dofs(unsigned int* dofs,
16466
 
                             const ufc::mesh& m,
 
16625
  virtual void tabulate_dofs(std::size_t* dofs,
 
16626
                             const std::vector<std::size_t>& num_global_entities,
16467
16627
                             const ufc::cell& c) const
16468
16628
  {
16469
16629
    unsigned int offset = 0;
16476
16636
    dofs[6] = offset + 3*c.entity_indices[1][2];
16477
16637
    dofs[7] = offset + 3*c.entity_indices[1][2] + 1;
16478
16638
    dofs[8] = offset + 3*c.entity_indices[1][2] + 2;
16479
 
    offset += 3*m.num_entities[1];
 
16639
    offset += 3*num_global_entities[1];
16480
16640
    dofs[9] = offset + 6*c.entity_indices[2][0];
16481
16641
    dofs[10] = offset + 6*c.entity_indices[2][0] + 1;
16482
16642
    dofs[11] = offset + 6*c.entity_indices[2][0] + 2;
16483
16643
    dofs[12] = offset + 6*c.entity_indices[2][0] + 3;
16484
16644
    dofs[13] = offset + 6*c.entity_indices[2][0] + 4;
16485
16645
    dofs[14] = offset + 6*c.entity_indices[2][0] + 5;
16486
 
    offset += 6*m.num_entities[2];
 
16646
    offset += 6*num_global_entities[2];
16487
16647
  }
16488
16648
 
16489
16649
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
16490
 
  virtual void tabulate_facet_dofs(unsigned int* dofs,
16491
 
                                   unsigned int facet) const
 
16650
  virtual void tabulate_facet_dofs(std::size_t* dofs,
 
16651
                                   std::size_t facet) const
16492
16652
  {
16493
16653
    switch (facet)
16494
16654
    {
16518
16678
  }
16519
16679
 
16520
16680
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
16521
 
  virtual void tabulate_entity_dofs(unsigned int* dofs,
16522
 
                                    unsigned int d, unsigned int i) const
 
16681
  virtual void tabulate_entity_dofs(std::size_t* dofs,
 
16682
                                    std::size_t d, std::size_t i) const
16523
16683
  {
16524
16684
    if (d > 2)
16525
16685
    {
16587
16747
  }
16588
16748
 
16589
16749
  /// Tabulate the coordinates of all dofs on a cell
16590
 
  virtual void tabulate_coordinates(double** coordinates,
16591
 
                                    const ufc::cell& c) const
 
16750
  virtual void tabulate_coordinates(double** dof_coordinates,
 
16751
                                    const double* vertex_coordinates) const
16592
16752
  {
16593
 
    const double * const * x = c.coordinates;
16594
 
    
16595
 
    coordinates[0][0] = 0.75*x[1][0] + 0.25*x[2][0];
16596
 
    coordinates[0][1] = 0.75*x[1][1] + 0.25*x[2][1];
16597
 
    coordinates[1][0] = 0.5*x[1][0] + 0.5*x[2][0];
16598
 
    coordinates[1][1] = 0.5*x[1][1] + 0.5*x[2][1];
16599
 
    coordinates[2][0] = 0.25*x[1][0] + 0.75*x[2][0];
16600
 
    coordinates[2][1] = 0.25*x[1][1] + 0.75*x[2][1];
16601
 
    coordinates[3][0] = 0.75*x[0][0] + 0.25*x[2][0];
16602
 
    coordinates[3][1] = 0.75*x[0][1] + 0.25*x[2][1];
16603
 
    coordinates[4][0] = 0.5*x[0][0] + 0.5*x[2][0];
16604
 
    coordinates[4][1] = 0.5*x[0][1] + 0.5*x[2][1];
16605
 
    coordinates[5][0] = 0.25*x[0][0] + 0.75*x[2][0];
16606
 
    coordinates[5][1] = 0.25*x[0][1] + 0.75*x[2][1];
16607
 
    coordinates[6][0] = 0.75*x[0][0] + 0.25*x[1][0];
16608
 
    coordinates[6][1] = 0.75*x[0][1] + 0.25*x[1][1];
16609
 
    coordinates[7][0] = 0.5*x[0][0] + 0.5*x[1][0];
16610
 
    coordinates[7][1] = 0.5*x[0][1] + 0.5*x[1][1];
16611
 
    coordinates[8][0] = 0.25*x[0][0] + 0.75*x[1][0];
16612
 
    coordinates[8][1] = 0.25*x[0][1] + 0.75*x[1][1];
16613
 
    coordinates[9][0] = 0.5*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0];
16614
 
    coordinates[9][1] = 0.5*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1];
16615
 
    coordinates[10][0] = 0.25*x[0][0] + 0.5*x[1][0] + 0.25*x[2][0];
16616
 
    coordinates[10][1] = 0.25*x[0][1] + 0.5*x[1][1] + 0.25*x[2][1];
16617
 
    coordinates[11][0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.5*x[2][0];
16618
 
    coordinates[11][1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.5*x[2][1];
16619
 
    coordinates[12][0] = 0.5*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0];
16620
 
    coordinates[12][1] = 0.5*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1];
16621
 
    coordinates[13][0] = 0.25*x[0][0] + 0.5*x[1][0] + 0.25*x[2][0];
16622
 
    coordinates[13][1] = 0.25*x[0][1] + 0.5*x[1][1] + 0.25*x[2][1];
16623
 
    coordinates[14][0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.5*x[2][0];
16624
 
    coordinates[14][1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.5*x[2][1];
 
16753
    dof_coordinates[0][0] = 0.75*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
16754
    dof_coordinates[0][1] = 0.75*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
 
16755
    dof_coordinates[1][0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
16756
    dof_coordinates[1][1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
 
16757
    dof_coordinates[2][0] = 0.25*vertex_coordinates[2] + 0.75*vertex_coordinates[4];
 
16758
    dof_coordinates[2][1] = 0.25*vertex_coordinates[3] + 0.75*vertex_coordinates[5];
 
16759
    dof_coordinates[3][0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[4];
 
16760
    dof_coordinates[3][1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[5];
 
16761
    dof_coordinates[4][0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
 
16762
    dof_coordinates[4][1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
 
16763
    dof_coordinates[5][0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[4];
 
16764
    dof_coordinates[5][1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[5];
 
16765
    dof_coordinates[6][0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[2];
 
16766
    dof_coordinates[6][1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[3];
 
16767
    dof_coordinates[7][0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
 
16768
    dof_coordinates[7][1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
 
16769
    dof_coordinates[8][0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[2];
 
16770
    dof_coordinates[8][1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[3];
 
16771
    dof_coordinates[9][0] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
16772
    dof_coordinates[9][1] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
 
16773
    dof_coordinates[10][0] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
16774
    dof_coordinates[10][1] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
 
16775
    dof_coordinates[11][0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
16776
    dof_coordinates[11][1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
 
16777
    dof_coordinates[12][0] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
16778
    dof_coordinates[12][1] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
 
16779
    dof_coordinates[13][0] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
16780
    dof_coordinates[13][1] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
 
16781
    dof_coordinates[14][0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
16782
    dof_coordinates[14][1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
16625
16783
  }
16626
16784
 
16627
16785
  /// Return the number of sub dofmaps (for a mixed element)
16628
 
  virtual unsigned int num_sub_dofmaps() const
 
16786
  virtual std::size_t num_sub_dofmaps() const
16629
16787
  {
16630
16788
    return 0;
16631
16789
  }
16632
16790
 
16633
16791
  /// Create a new dofmap for sub dofmap i (for a mixed element)
16634
 
  virtual ufc::dofmap* create_sub_dofmap(unsigned int i) const
 
16792
  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
16635
16793
  {
16636
16794
    return 0;
16637
16795
  }
16649
16807
 
16650
16808
class mixedmixedelement_dofmap_5: public ufc::dofmap
16651
16809
{
16652
 
private:
16653
 
 
16654
 
  unsigned int _global_dimension;
16655
16810
public:
16656
16811
 
16657
16812
  /// Constructor
16658
16813
  mixedmixedelement_dofmap_5() : ufc::dofmap()
16659
16814
  {
16660
 
    _global_dimension = 0;
 
16815
    // Do nothing
16661
16816
  }
16662
16817
 
16663
16818
  /// Destructor
16669
16824
  /// Return a string identifying the dofmap
16670
16825
  virtual const char* signature() const
16671
16826
  {
16672
 
    return "FFC dofmap for MixedElement(*[MixedElement(*[VectorElement('Discontinuous Lagrange', Cell('triangle', Space(2)), 0, 2, None), FiniteElement('Lagrange', Cell('triangle', Space(2)), 2, None)], **{'value_shape': (3,) }), FiniteElement('Raviart-Thomas', Cell('triangle', Space(2)), 3, None)], **{'value_shape': (5,) })";
 
16827
    return "FFC dofmap for MixedElement(*[MixedElement(*[VectorElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 0, 2, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 2, None)], **{'value_shape': (3,) }), FiniteElement('Raviart-Thomas', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 3, None)], **{'value_shape': (5,) })";
16673
16828
  }
16674
16829
 
16675
16830
  /// Return true iff mesh entities of topological dimension d are needed
16676
 
  virtual bool needs_mesh_entities(unsigned int d) const
 
16831
  virtual bool needs_mesh_entities(std::size_t d) const
16677
16832
  {
16678
16833
    switch (d)
16679
16834
    {
16697
16852
    return false;
16698
16853
  }
16699
16854
 
16700
 
  /// Initialize dofmap for mesh (return true iff init_cell() is needed)
16701
 
  virtual bool init_mesh(const ufc::mesh& m)
16702
 
  {
16703
 
    _global_dimension = m.num_entities[0] + 4*m.num_entities[1] + 8*m.num_entities[2];
16704
 
    return false;
16705
 
  }
16706
 
 
16707
 
  /// Initialize dofmap for given cell
16708
 
  virtual void init_cell(const ufc::mesh& m,
16709
 
                         const ufc::cell& c)
16710
 
  {
16711
 
    // Do nothing
16712
 
  }
16713
 
 
16714
 
  /// Finish initialization of dofmap for cells
16715
 
  virtual void init_cell_finalize()
16716
 
  {
16717
 
    // Do nothing
16718
 
  }
16719
 
 
16720
16855
  /// Return the topological dimension of the associated cell shape
16721
 
  virtual unsigned int topological_dimension() const
 
16856
  virtual std::size_t topological_dimension() const
16722
16857
  {
16723
16858
    return 2;
16724
16859
  }
16725
16860
 
16726
16861
  /// Return the geometric dimension of the associated cell shape
16727
 
  virtual unsigned int geometric_dimension() const
 
16862
  virtual std::size_t geometric_dimension() const
16728
16863
  {
16729
16864
    return 2;
16730
16865
  }
16731
16866
 
16732
16867
  /// Return the dimension of the global finite element function space
16733
 
  virtual unsigned int global_dimension() const
 
16868
  virtual std::size_t global_dimension(const std::vector<std::size_t>&
 
16869
                                       num_global_entities) const
16734
16870
  {
16735
 
    return _global_dimension;
 
16871
    return num_global_entities[0] + 4*num_global_entities[1] + 8*num_global_entities[2];
16736
16872
  }
16737
16873
 
16738
16874
  /// Return the dimension of the local finite element function space for a cell
16739
 
  virtual unsigned int local_dimension(const ufc::cell& c) const
 
16875
  virtual std::size_t local_dimension(const ufc::cell& c) const
16740
16876
  {
16741
16877
    return 23;
16742
16878
  }
16743
16879
 
16744
16880
  /// Return the maximum dimension of the local finite element function space
16745
 
  virtual unsigned int max_local_dimension() const
 
16881
  virtual std::size_t max_local_dimension() const
16746
16882
  {
16747
16883
    return 23;
16748
16884
  }
16749
16885
 
16750
16886
  /// Return the number of dofs on each cell facet
16751
 
  virtual unsigned int num_facet_dofs() const
 
16887
  virtual std::size_t num_facet_dofs() const
16752
16888
  {
16753
16889
    return 6;
16754
16890
  }
16755
16891
 
16756
16892
  /// Return the number of dofs associated with each cell entity of dimension d
16757
 
  virtual unsigned int num_entity_dofs(unsigned int d) const
 
16893
  virtual std::size_t num_entity_dofs(std::size_t d) const
16758
16894
  {
16759
16895
    switch (d)
16760
16896
    {
16779
16915
  }
16780
16916
 
16781
16917
  /// Tabulate the local-to-global mapping of dofs on a cell
16782
 
  virtual void tabulate_dofs(unsigned int* dofs,
16783
 
                             const ufc::mesh& m,
 
16918
  virtual void tabulate_dofs(std::size_t* dofs,
 
16919
                             const std::vector<std::size_t>& num_global_entities,
16784
16920
                             const ufc::cell& c) const
16785
16921
  {
16786
16922
    unsigned int offset = 0;
16787
16923
    dofs[0] = offset + c.entity_indices[2][0];
16788
 
    offset += m.num_entities[2];
 
16924
    offset += num_global_entities[2];
16789
16925
    dofs[1] = offset + c.entity_indices[2][0];
16790
 
    offset += m.num_entities[2];
 
16926
    offset += num_global_entities[2];
16791
16927
    dofs[2] = offset + c.entity_indices[0][0];
16792
16928
    dofs[3] = offset + c.entity_indices[0][1];
16793
16929
    dofs[4] = offset + c.entity_indices[0][2];
16794
 
    offset += m.num_entities[0];
 
16930
    offset += num_global_entities[0];
16795
16931
    dofs[5] = offset + c.entity_indices[1][0];
16796
16932
    dofs[6] = offset + c.entity_indices[1][1];
16797
16933
    dofs[7] = offset + c.entity_indices[1][2];
16798
 
    offset += m.num_entities[1];
 
16934
    offset += num_global_entities[1];
16799
16935
    dofs[8] = offset + 3*c.entity_indices[1][0];
16800
16936
    dofs[9] = offset + 3*c.entity_indices[1][0] + 1;
16801
16937
    dofs[10] = offset + 3*c.entity_indices[1][0] + 2;
16805
16941
    dofs[14] = offset + 3*c.entity_indices[1][2];
16806
16942
    dofs[15] = offset + 3*c.entity_indices[1][2] + 1;
16807
16943
    dofs[16] = offset + 3*c.entity_indices[1][2] + 2;
16808
 
    offset += 3*m.num_entities[1];
 
16944
    offset += 3*num_global_entities[1];
16809
16945
    dofs[17] = offset + 6*c.entity_indices[2][0];
16810
16946
    dofs[18] = offset + 6*c.entity_indices[2][0] + 1;
16811
16947
    dofs[19] = offset + 6*c.entity_indices[2][0] + 2;
16812
16948
    dofs[20] = offset + 6*c.entity_indices[2][0] + 3;
16813
16949
    dofs[21] = offset + 6*c.entity_indices[2][0] + 4;
16814
16950
    dofs[22] = offset + 6*c.entity_indices[2][0] + 5;
16815
 
    offset += 6*m.num_entities[2];
 
16951
    offset += 6*num_global_entities[2];
16816
16952
  }
16817
16953
 
16818
16954
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
16819
 
  virtual void tabulate_facet_dofs(unsigned int* dofs,
16820
 
                                   unsigned int facet) const
 
16955
  virtual void tabulate_facet_dofs(std::size_t* dofs,
 
16956
                                   std::size_t facet) const
16821
16957
  {
16822
16958
    switch (facet)
16823
16959
    {
16856
16992
  }
16857
16993
 
16858
16994
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
16859
 
  virtual void tabulate_entity_dofs(unsigned int* dofs,
16860
 
                                    unsigned int d, unsigned int i) const
 
16995
  virtual void tabulate_entity_dofs(std::size_t* dofs,
 
16996
                                    std::size_t d, std::size_t i) const
16861
16997
  {
16862
16998
    if (d > 2)
16863
16999
    {
16953
17089
  }
16954
17090
 
16955
17091
  /// Tabulate the coordinates of all dofs on a cell
16956
 
  virtual void tabulate_coordinates(double** coordinates,
16957
 
                                    const ufc::cell& c) const
 
17092
  virtual void tabulate_coordinates(double** dof_coordinates,
 
17093
                                    const double* vertex_coordinates) const
16958
17094
  {
16959
 
    const double * const * x = c.coordinates;
16960
 
    
16961
 
    coordinates[0][0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
16962
 
    coordinates[0][1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
16963
 
    coordinates[1][0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
16964
 
    coordinates[1][1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
16965
 
    coordinates[2][0] = x[0][0];
16966
 
    coordinates[2][1] = x[0][1];
16967
 
    coordinates[3][0] = x[1][0];
16968
 
    coordinates[3][1] = x[1][1];
16969
 
    coordinates[4][0] = x[2][0];
16970
 
    coordinates[4][1] = x[2][1];
16971
 
    coordinates[5][0] = 0.5*x[1][0] + 0.5*x[2][0];
16972
 
    coordinates[5][1] = 0.5*x[1][1] + 0.5*x[2][1];
16973
 
    coordinates[6][0] = 0.5*x[0][0] + 0.5*x[2][0];
16974
 
    coordinates[6][1] = 0.5*x[0][1] + 0.5*x[2][1];
16975
 
    coordinates[7][0] = 0.5*x[0][0] + 0.5*x[1][0];
16976
 
    coordinates[7][1] = 0.5*x[0][1] + 0.5*x[1][1];
16977
 
    coordinates[8][0] = 0.75*x[1][0] + 0.25*x[2][0];
16978
 
    coordinates[8][1] = 0.75*x[1][1] + 0.25*x[2][1];
16979
 
    coordinates[9][0] = 0.5*x[1][0] + 0.5*x[2][0];
16980
 
    coordinates[9][1] = 0.5*x[1][1] + 0.5*x[2][1];
16981
 
    coordinates[10][0] = 0.25*x[1][0] + 0.75*x[2][0];
16982
 
    coordinates[10][1] = 0.25*x[1][1] + 0.75*x[2][1];
16983
 
    coordinates[11][0] = 0.75*x[0][0] + 0.25*x[2][0];
16984
 
    coordinates[11][1] = 0.75*x[0][1] + 0.25*x[2][1];
16985
 
    coordinates[12][0] = 0.5*x[0][0] + 0.5*x[2][0];
16986
 
    coordinates[12][1] = 0.5*x[0][1] + 0.5*x[2][1];
16987
 
    coordinates[13][0] = 0.25*x[0][0] + 0.75*x[2][0];
16988
 
    coordinates[13][1] = 0.25*x[0][1] + 0.75*x[2][1];
16989
 
    coordinates[14][0] = 0.75*x[0][0] + 0.25*x[1][0];
16990
 
    coordinates[14][1] = 0.75*x[0][1] + 0.25*x[1][1];
16991
 
    coordinates[15][0] = 0.5*x[0][0] + 0.5*x[1][0];
16992
 
    coordinates[15][1] = 0.5*x[0][1] + 0.5*x[1][1];
16993
 
    coordinates[16][0] = 0.25*x[0][0] + 0.75*x[1][0];
16994
 
    coordinates[16][1] = 0.25*x[0][1] + 0.75*x[1][1];
16995
 
    coordinates[17][0] = 0.5*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0];
16996
 
    coordinates[17][1] = 0.5*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1];
16997
 
    coordinates[18][0] = 0.25*x[0][0] + 0.5*x[1][0] + 0.25*x[2][0];
16998
 
    coordinates[18][1] = 0.25*x[0][1] + 0.5*x[1][1] + 0.25*x[2][1];
16999
 
    coordinates[19][0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.5*x[2][0];
17000
 
    coordinates[19][1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.5*x[2][1];
17001
 
    coordinates[20][0] = 0.5*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0];
17002
 
    coordinates[20][1] = 0.5*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1];
17003
 
    coordinates[21][0] = 0.25*x[0][0] + 0.5*x[1][0] + 0.25*x[2][0];
17004
 
    coordinates[21][1] = 0.25*x[0][1] + 0.5*x[1][1] + 0.25*x[2][1];
17005
 
    coordinates[22][0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.5*x[2][0];
17006
 
    coordinates[22][1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.5*x[2][1];
 
17095
    dof_coordinates[0][0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
17096
    dof_coordinates[0][1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
 
17097
    dof_coordinates[1][0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
 
17098
    dof_coordinates[1][1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
 
17099
    dof_coordinates[2][0] = vertex_coordinates[0];
 
17100
    dof_coordinates[2][1] = vertex_coordinates[1];
 
17101
    dof_coordinates[3][0] = vertex_coordinates[2];
 
17102
    dof_coordinates[3][1] = vertex_coordinates[3];
 
17103
    dof_coordinates[4][0] = vertex_coordinates[4];
 
17104
    dof_coordinates[4][1] = vertex_coordinates[5];
 
17105
    dof_coordinates[5][0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
17106
    dof_coordinates[5][1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
 
17107
    dof_coordinates[6][0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
 
17108
    dof_coordinates[6][1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
 
17109
    dof_coordinates[7][0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
 
17110
    dof_coordinates[7][1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
 
17111
    dof_coordinates[8][0] = 0.75*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
17112
    dof_coordinates[8][1] = 0.75*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
 
17113
    dof_coordinates[9][0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
17114
    dof_coordinates[9][1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
 
17115
    dof_coordinates[10][0] = 0.25*vertex_coordinates[2] + 0.75*vertex_coordinates[4];
 
17116
    dof_coordinates[10][1] = 0.25*vertex_coordinates[3] + 0.75*vertex_coordinates[5];
 
17117
    dof_coordinates[11][0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[4];
 
17118
    dof_coordinates[11][1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[5];
 
17119
    dof_coordinates[12][0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
 
17120
    dof_coordinates[12][1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
 
17121
    dof_coordinates[13][0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[4];
 
17122
    dof_coordinates[13][1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[5];
 
17123
    dof_coordinates[14][0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[2];
 
17124
    dof_coordinates[14][1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[3];
 
17125
    dof_coordinates[15][0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
 
17126
    dof_coordinates[15][1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
 
17127
    dof_coordinates[16][0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[2];
 
17128
    dof_coordinates[16][1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[3];
 
17129
    dof_coordinates[17][0] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
17130
    dof_coordinates[17][1] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
 
17131
    dof_coordinates[18][0] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
17132
    dof_coordinates[18][1] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
 
17133
    dof_coordinates[19][0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
17134
    dof_coordinates[19][1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
 
17135
    dof_coordinates[20][0] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
17136
    dof_coordinates[20][1] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
 
17137
    dof_coordinates[21][0] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
 
17138
    dof_coordinates[21][1] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
 
17139
    dof_coordinates[22][0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
 
17140
    dof_coordinates[22][1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
17007
17141
  }
17008
17142
 
17009
17143
  /// Return the number of sub dofmaps (for a mixed element)
17010
 
  virtual unsigned int num_sub_dofmaps() const
 
17144
  virtual std::size_t num_sub_dofmaps() const
17011
17145
  {
17012
17146
    return 2;
17013
17147
  }
17014
17148
 
17015
17149
  /// Create a new dofmap for sub dofmap i (for a mixed element)
17016
 
  virtual ufc::dofmap* create_sub_dofmap(unsigned int i) const
 
17150
  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
17017
17151
  {
17018
17152
    switch (i)
17019
17153
    {
17044
17178
/// tensor corresponding to the local contribution to a form from
17045
17179
/// the integral over a cell.
17046
17180
 
17047
 
class mixedmixedelement_cell_integral_0_0: public ufc::cell_integral
 
17181
class mixedmixedelement_cell_integral_0_otherwise: public ufc::cell_integral
17048
17182
{
17049
17183
public:
17050
17184
 
17051
17185
  /// Constructor
17052
 
  mixedmixedelement_cell_integral_0_0() : ufc::cell_integral()
 
17186
  mixedmixedelement_cell_integral_0_otherwise() : ufc::cell_integral()
17053
17187
  {
17054
17188
    // Do nothing
17055
17189
  }
17056
17190
 
17057
17191
  /// Destructor
17058
 
  virtual ~mixedmixedelement_cell_integral_0_0()
 
17192
  virtual ~mixedmixedelement_cell_integral_0_otherwise()
17059
17193
  {
17060
17194
    // Do nothing
17061
17195
  }
17063
17197
  /// Tabulate the tensor for the contribution from a local cell
17064
17198
  virtual void tabulate_tensor(double* A,
17065
17199
                               const double * const * w,
17066
 
                               const ufc::cell& c) const
 
17200
                               const double* vertex_coordinates,
 
17201
                               int cell_orientation) const
17067
17202
  {
17068
 
    // Number of operations (multiply-add pairs) for Jacobian data:      9
 
17203
    // Number of operations (multiply-add pairs) for Jacobian data:      3
17069
17204
    // Number of operations (multiply-add pairs) for geometry tensor:    0
17070
17205
    // Number of operations (multiply-add pairs) for tensor contraction: 0
17071
 
    // Total number of operations (multiply-add pairs):                  9
17072
 
    
17073
 
    // Extract vertex coordinates
17074
 
    const double * const * x = c.coordinates;
17075
 
    
17076
 
    // Compute Jacobian of affine map from reference cell
17077
 
    const double J_00 = x[1][0] - x[0][0];
17078
 
    const double J_01 = x[2][0] - x[0][0];
17079
 
    const double J_10 = x[1][1] - x[0][1];
17080
 
    const double J_11 = x[2][1] - x[0][1];
17081
 
    
17082
 
    // Compute determinant of Jacobian
17083
 
    double detJ = J_00*J_11 - J_01*J_10;
17084
 
    
17085
 
    // Compute inverse of Jacobian
 
17206
    // Total number of operations (multiply-add pairs):                  3
 
17207
    
 
17208
    // Compute Jacobian
 
17209
    double J[4];
 
17210
    compute_jacobian_triangle_2d(J, vertex_coordinates);
 
17211
    
 
17212
    // Compute Jacobian inverse and determinant
 
17213
    double K[4];
 
17214
    double detJ;
 
17215
    compute_jacobian_inverse_triangle_2d(K, detJ, J);
17086
17216
    
17087
17217
    // Set scale factor
17088
17218
    const double det = std::abs(detJ);
17116
17246
    A[22] = 0.0;
17117
17247
  }
17118
17248
 
17119
 
  /// Tabulate the tensor for the contribution from a local cell
17120
 
  /// using the specified reference cell quadrature points/weights
17121
 
  virtual void tabulate_tensor(double* A,
17122
 
                               const double * const * w,
17123
 
                               const ufc::cell& c,
17124
 
                               unsigned int num_quadrature_points,
17125
 
                               const double * const * quadrature_points,
17126
 
                               const double* quadrature_weights) const
17127
 
  {
17128
 
    std::cerr << "*** FFC warning: " << "Quadrature version of tabulate_tensor not available when using the FFC tensor representation." << std::endl;
17129
 
  }
17130
 
 
17131
17249
};
17132
17250
 
17133
17251
/// This class defines the interface for the assembly of the global
17164
17282
  /// Return a string identifying the form
17165
17283
  virtual const char* signature() const
17166
17284
  {
17167
 
    return "Form([Integral(Indexed(Argument(MixedElement(*[MixedElement(*[VectorElement('Discontinuous Lagrange', Cell('triangle', Space(2)), 0, 2, None), FiniteElement('Lagrange', Cell('triangle', Space(2)), 2, None)], **{'value_shape': (3,) }), FiniteElement('Raviart-Thomas', Cell('triangle', Space(2)), 3, None)], **{'value_shape': (5,) }), 0), MultiIndex((FixedIndex(0),), {})), Measure('cell', 0, None))])";
 
17285
    return "4dbd6ffce91104cca6203350dd5899d91933e7a0ff03b5e3d1e43c46be855704ea0938c37d2dc1542a93ea929629248d53f538a8c8fd87383de2bb660568b10b";
17168
17286
  }
17169
17287
 
17170
17288
  /// Return the rank of the global tensor (r)
17171
 
  virtual unsigned int rank() const
 
17289
  virtual std::size_t rank() const
17172
17290
  {
17173
17291
    return 1;
17174
17292
  }
17175
17293
 
17176
17294
  /// Return the number of coefficients (n)
17177
 
  virtual unsigned int num_coefficients() const
 
17295
  virtual std::size_t num_coefficients() const
17178
17296
  {
17179
17297
    return 0;
17180
17298
  }
17181
17299
 
17182
17300
  /// Return the number of cell domains
17183
 
  virtual unsigned int num_cell_domains() const
 
17301
  virtual std::size_t num_cell_domains() const
17184
17302
  {
17185
 
    return 1;
 
17303
    return 0;
17186
17304
  }
17187
17305
 
17188
17306
  /// Return the number of exterior facet domains
17189
 
  virtual unsigned int num_exterior_facet_domains() const
 
17307
  virtual std::size_t num_exterior_facet_domains() const
17190
17308
  {
17191
17309
    return 0;
17192
17310
  }
17193
17311
 
17194
17312
  /// Return the number of interior facet domains
17195
 
  virtual unsigned int num_interior_facet_domains() const
17196
 
  {
17197
 
    return 0;
 
17313
  virtual std::size_t num_interior_facet_domains() const
 
17314
  {
 
17315
    return 0;
 
17316
  }
 
17317
 
 
17318
  /// Return the number of point domains
 
17319
  virtual std::size_t num_point_domains() const
 
17320
  {
 
17321
    return 0;
 
17322
  }
 
17323
 
 
17324
  /// Return whether the form has any cell integrals
 
17325
  virtual bool has_cell_integrals() const
 
17326
  {
 
17327
    return true;
 
17328
  }
 
17329
 
 
17330
  /// Return whether the form has any exterior facet integrals
 
17331
  virtual bool has_exterior_facet_integrals() const
 
17332
  {
 
17333
    return false;
 
17334
  }
 
17335
 
 
17336
  /// Return whether the form has any interior facet integrals
 
17337
  virtual bool has_interior_facet_integrals() const
 
17338
  {
 
17339
    return false;
 
17340
  }
 
17341
 
 
17342
  /// Return whether the form has any point integrals
 
17343
  virtual bool has_point_integrals() const
 
17344
  {
 
17345
    return false;
17198
17346
  }
17199
17347
 
17200
17348
  /// Create a new finite element for argument function i
17201
 
  virtual ufc::finite_element* create_finite_element(unsigned int i) const
 
17349
  virtual ufc::finite_element* create_finite_element(std::size_t i) const
17202
17350
  {
17203
17351
    switch (i)
17204
17352
    {
17213
17361
  }
17214
17362
 
17215
17363
  /// Create a new dofmap for argument function i
17216
 
  virtual ufc::dofmap* create_dofmap(unsigned int i) const
 
17364
  virtual ufc::dofmap* create_dofmap(std::size_t i) const
17217
17365
  {
17218
17366
    switch (i)
17219
17367
    {
17228
17376
  }
17229
17377
 
17230
17378
  /// Create a new cell integral on sub domain i
17231
 
  virtual ufc::cell_integral* create_cell_integral(unsigned int i) const
 
17379
  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const
17232
17380
  {
17233
 
    switch (i)
17234
 
    {
17235
 
    case 0:
17236
 
      {
17237
 
        return new mixedmixedelement_cell_integral_0_0();
17238
 
        break;
17239
 
      }
17240
 
    }
17241
 
    
17242
17381
    return 0;
17243
17382
  }
17244
17383
 
17245
17384
  /// Create a new exterior facet integral on sub domain i
17246
 
  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(unsigned int i) const
 
17385
  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const
17247
17386
  {
17248
17387
    return 0;
17249
17388
  }
17250
17389
 
17251
17390
  /// Create a new interior facet integral on sub domain i
17252
 
  virtual ufc::interior_facet_integral* create_interior_facet_integral(unsigned int i) const
 
17391
  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const
 
17392
  {
 
17393
    return 0;
 
17394
  }
 
17395
 
 
17396
  /// Create a new point integral on sub domain i
 
17397
  virtual ufc::point_integral* create_point_integral(std::size_t i) const
 
17398
  {
 
17399
    return 0;
 
17400
  }
 
17401
 
 
17402
  /// Create a new cell integral on everywhere else
 
17403
  virtual ufc::cell_integral* create_default_cell_integral() const
 
17404
  {
 
17405
    return new mixedmixedelement_cell_integral_0_otherwise();
 
17406
  }
 
17407
 
 
17408
  /// Create a new exterior facet integral on everywhere else
 
17409
  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
 
17410
  {
 
17411
    return 0;
 
17412
  }
 
17413
 
 
17414
  /// Create a new interior facet integral on everywhere else
 
17415
  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
 
17416
  {
 
17417
    return 0;
 
17418
  }
 
17419
 
 
17420
  /// Create a new point integral on everywhere else
 
17421
  virtual ufc::point_integral* create_default_point_integral() const
17253
17422
  {
17254
17423
    return 0;
17255
17424
  }