This file is indexed.

/usr/include/trilinos/Intrepid_FunctionSpaceTools.hpp is in libtrilinos-intrepid-dev 12.4.2-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
// @HEADER
// ************************************************************************
//
//                           Intrepid Package
//                 Copyright (2007) Sandia Corporation
//
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
// license for use of this work by or on behalf of the U.S. Government.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Pavel Bochev  (pbboche@sandia.gov)
//                    Denis Ridzal  (dridzal@sandia.gov), or
//                    Kara Peterson (kjpeter@sandia.gov)
//
// ************************************************************************
// @HEADER

/** \file   Intrepid_FunctionSpaceTools.hpp
    \brief  Header file for the Intrepid::FunctionSpaceTools class.
    \author Created by P. Bochev and D. Ridzal.
*/

#ifndef INTREPID_FUNCTIONSPACETOOLS_HPP
#define INTREPID_FUNCTIONSPACETOOLS_HPP

#include "Intrepid_ConfigDefs.hpp"
#include "Intrepid_ArrayTools.hpp"
#include "Intrepid_RealSpaceTools.hpp"
#include "Intrepid_FieldContainer.hpp"
#include "Intrepid_CellTools.hpp"

#include <KokkosRank.hpp>


namespace Intrepid {

/** \class Intrepid::FunctionSpaceTools
    \brief Defines expert-level interfaces for the evaluation of functions
           and operators in physical space (supported for FE, FV, and FD methods)
           and FE reference space; in addition, provides several function
           transformation utilities.
*/
class FunctionSpaceTools {
  public:
  /** \brief Transformation of a (scalar) value field in the H-grad space, defined at points on a
             reference cell, stored in the user-provided container <var><b>inVals</b></var>
             and indexed by (F,P), into the output container <var><b>outVals</b></var>,
             defined on cells in physical space and indexed by (C,F,P).
   
             Computes pullback of \e HGRAD functions \f$\Phi^*(\widehat{u}_f) = \widehat{u}_f\circ F^{-1}_{c} \f$ 
             for points in one or more physical cells that are images of a given set of points in the reference cell:
      \f[
             \{ x_{c,p} \}_{p=0}^P = \{ F_{c} (\widehat{x}_p) \}_{p=0}^{P}\qquad 0\le c < C \,.
      \f]     
             In this case \f$ F^{-1}_{c}(x_{c,p}) = \widehat{x}_p \f$ and the user-provided container
             should contain the values of the function set \f$\{\widehat{u}_f\}_{f=0}^{F}\f$ at the 
             reference points:
      \f[
             inVals(f,p) = \widehat{u}_f(\widehat{x}_p) \,.
      \f]
             The method returns   
      \f[
             outVals(c,f,p) 
                = \widehat{u}_f\circ F^{-1}_{c}(x_{c,p}) 
                = \widehat{u}_f(\widehat{x}_p) =  inVals(f,p) \qquad 0\le c < C \,,
      \f]
            i.e., it simply replicates the values in the user-provided container to every cell. 
            See Section \ref sec_pullbacks for more details about pullbacks. 
    
    \code
    |------|----------------------|--------------------------------------------------|
    |      |         Index        |                   Dimension                      |
    |------|----------------------|--------------------------------------------------|
    |   C  |         cell         |  0 <= C < num. integration domains               |
    |   F  |         field        |  0 <= F < dim. of the basis                      |
    |   P  |         point        |  0 <= P < num. integration points                |
    |------|----------------------|--------------------------------------------------|
    \endcode
  */
  template<class Scalar, class ArrayTypeOut, class ArrayTypeIn>
  static void HGRADtransformVALUE(ArrayTypeOut       & outVals,
                                  const ArrayTypeIn  & inVals);
/*
  template<class Scalar, class ArrayTypeOut, class ArrayTypeIn>
  static void HGRADtransformVALUETemp(ArrayTypeOut       & outVals,
                                  const ArrayTypeIn  & inVals);*/
  /** \brief Transformation of a gradient field in the H-grad space, defined at points on a
             reference cell, stored in the user-provided container <var><b>inVals</b></var>
             and indexed by (F,P,D), into the output container <var><b>outVals</b></var>,
             defined on cells in physical space and indexed by (C,F,P,D).

             Computes pullback of gradients of \e HGRAD functions 
             \f$\Phi^*(\nabla\widehat{u}_f) = \left((DF_c)^{-{\sf T}}\cdot\nabla\widehat{u}_f\right)\circ F^{-1}_{c}\f$ 
             for points in one or more physical cells that are images of a given set of points in the reference cell:
      \f[
             \{ x_{c,p} \}_{p=0}^P = \{ F_{c} (\widehat{x}_p) \}_{p=0}^{P}\qquad 0\le c < C \,.
      \f]     
             In this case \f$ F^{-1}_{c}(x_{c,p}) = \widehat{x}_p \f$ and the user-provided container
             should contain the gradients of the function set \f$\{\widehat{u}_f\}_{f=0}^{F}\f$ at the 
             reference points:
      \f[
             inVals(f,p,*) = \nabla\widehat{u}_f(\widehat{x}_p) \,.
      \f]
             The method returns   
      \f[
             outVals(c,f,p,*) 
                  = \left((DF_c)^{-{\sf T}}\cdot\nabla\widehat{u}_f\right)\circ F^{-1}_{c}(x_{c,p}) 
                  = (DF_c)^{-{\sf T}}(\widehat{x}_p)\cdot\nabla\widehat{u}_f(\widehat{x}_p) \qquad 0\le c < C \,.
      \f]
             See Section \ref sec_pullbacks for more details about pullbacks.
  
    \code
    |------|----------------------|--------------------------------------------------|
    |      |         Index        |                   Dimension                      |
    |------|----------------------|--------------------------------------------------|
    |   C  |         cell         |  0 <= C < num. integration domains               |
    |   F  |         field        |  0 <= F < dim. of the basis                      |
    |   P  |         point        |  0 <= P < num. integration points                |
    |   D  |         space dim    |  0 <= D < spatial dimension                      |
    |------|----------------------|--------------------------------------------------|
    \endcode
  */
  template<class Scalar, class ArrayTypeOut, class ArrayTypeJac, class ArrayTypeIn>
  static void HGRADtransformGRAD(ArrayTypeOut       & outVals,
                                 const ArrayTypeJac & jacobianInverse,
                                 const ArrayTypeIn  & inVals,
                                 const char           transpose = 'T');
                                 /*
    template<class Scalar, class ArrayTypeOut, class ArrayTypeJac, class ArrayTypeIn>
  static void HGRADtransformGRADTemp(ArrayTypeOut       & outVals,
                                 const ArrayTypeJac & jacobianInverse,
                                 const ArrayTypeIn  & inVals,
                                 const char           transpose = 'T');
*/
  /** \brief Transformation of a (vector) value field in the H-curl space, defined at points on a
             reference cell, stored in the user-provided container <var><b>inVals</b></var>
             and indexed by (F,P,D), into the output container <var><b>outVals</b></var>,
             defined on cells in physical space and indexed by (C,F,P,D).

             Computes pullback of \e HCURL functions 
             \f$\Phi^*(\widehat{\bf u}_f) = \left((DF_c)^{-{\sf T}}\cdot\widehat{\bf u}_f\right)\circ F^{-1}_{c}\f$ 
             for points in one or more physical cells that are images of a given set of points in the reference cell:
      \f[
             \{ x_{c,p} \}_{p=0}^P = \{ F_{c} (\widehat{x}_p) \}_{p=0}^{P}\qquad 0\le c < C \,.
      \f]     
             In this case \f$ F^{-1}_{c}(x_{c,p}) = \widehat{x}_p \f$ and the user-provided container
             should contain the values of the vector function set \f$\{\widehat{\bf u}_f\}_{f=0}^{F}\f$ at the 
             reference points:
      \f[
             inVals(f,p,*) = \widehat{\bf u}_f(\widehat{x}_p) \,.
      \f]
             The method returns   
      \f[
              outVals(c,f,p,*) 
                = \left((DF_c)^{-{\sf T}}\cdot\widehat{\bf u}_f\right)\circ F^{-1}_{c}(x_{c,p}) 
                = (DF_c)^{-{\sf T}}(\widehat{x}_p)\cdot\widehat{\bf u}_f(\widehat{x}_p) \qquad 0\le c < C \,.
      \f]
            See Section \ref sec_pullbacks for more details about pullbacks.
    \code
    |------|----------------------|--------------------------------------------------|
    |      |         Index        |                   Dimension                      |
    |------|----------------------|--------------------------------------------------|
    |   C  |         cell         |  0 <= C < num. integration domains               |
    |   F  |         field        |  0 <= F < dim. of native basis                   |
    |   P  |         point        |  0 <= P < num. integration points                |
    |   D  |         space dim    |  0 <= D < spatial dimension                      |
    |------|----------------------|--------------------------------------------------|
    \endcode
  */
  template<class Scalar, class ArrayTypeOut, class ArrayTypeJac, class ArrayTypeIn>
  static void HCURLtransformVALUE(ArrayTypeOut        & outVals,
                                  const ArrayTypeJac  & jacobianInverse,
                                  const ArrayTypeIn   & inVals,
                                  const char            transpose = 'T');
                                  /*
  template<class Scalar, class ArrayTypeOut, class ArrayTypeJac, class ArrayTypeIn>
  static void HCURLtransformVALUETemp(ArrayTypeOut        & outVals,
                                  const ArrayTypeJac  & jacobianInverse,
                                  const ArrayTypeIn   & inVals,
                                  const char            transpose = 'T');*/
  /** \brief Transformation of a curl field in the H-curl space, defined at points on a
             reference cell, stored in the user-provided container <var><b>inVals</b></var>
             and indexed by (F,P,D), into the output container <var><b>outVals</b></var>,
             defined on cells in physical space and indexed by (C,F,P,D).

             Computes pullback of curls of \e HCURL functions 
             \f$\Phi^*(\widehat{\bf u}_f) = \left(J^{-1}_{c} DF_{c}\cdot\nabla\times\widehat{\bf u}_f\right)\circ F^{-1}_{c}\f$ 
             for points in one or more physical cells that are images of a given set of points in the reference cell:
      \f[
             \{ x_{c,p} \}_{p=0}^P = \{ F_{c} (\widehat{x}_p) \}_{p=0}^{P}\qquad 0\le c < C \,.
      \f]     
             In this case \f$ F^{-1}_{c}(x_{c,p}) = \widehat{x}_p \f$ and the user-provided container
             should contain the curls of the vector function set \f$\{\widehat{\bf u}_f\}_{f=0}^{F}\f$ at the 
             reference points:
      \f[
             inVals(f,p,*) = \nabla\times\widehat{\bf u}_f(\widehat{x}_p) \,.
      \f]
             The method returns   
      \f[
             outVals(c,f,p,*) 
                = \left(J^{-1}_{c} DF_{c}\cdot\nabla\times\widehat{\bf u}_f\right)\circ F^{-1}_{c}(x_{c,p}) 
                = J^{-1}_{c}(\widehat{x}_p) DF_{c}(\widehat{x}_p)\cdot\nabla\times\widehat{\bf u}_f(\widehat{x}_p)
              \qquad 0\le c < C \,.
      \f]
             See Section \ref sec_pullbacks for more details about pullbacks.
    
    \code
    |------|----------------------|--------------------------------------------------|
    |      |         Index        |                   Dimension                      |
    |------|----------------------|--------------------------------------------------|
    |   C  |         cell         |  0 <= C < num. integration domains               |
    |   F  |         field        |  0 <= F < dim. of the basis                      |
    |   P  |         point        |  0 <= P < num. integration points                |
    |   D  |         space dim    |  0 <= D < spatial dimension                      |
    |------|----------------------|--------------------------------------------------|
    \endcode
  */
  template<class Scalar, class ArrayTypeOut, class ArrayTypeJac, class ArrayTypeDet, class ArrayTypeIn>
  static void HCURLtransformCURL(ArrayTypeOut        & outVals,
                                 const ArrayTypeJac  & jacobian,
                                 const ArrayTypeDet  & jacobianDet,
                                 const ArrayTypeIn   & inVals,
                                 const char            transpose = 'N');
                                 /*
  template<class Scalar, class ArrayTypeOut, class ArrayTypeJac, class ArrayTypeDet, class ArrayTypeIn>
  static void HCURLtransformCURLTemp(ArrayTypeOut        & outVals,
                                 const ArrayTypeJac  & jacobian,
                                 const ArrayTypeDet  & jacobianDet,
                                 const ArrayTypeIn   & inVals,
                                 const char            transpose = 'N');*/
  /** \brief Transformation of a (vector) value field in the H-div space, defined at points on a
             reference cell, stored in the user-provided container <var><b>inVals</b></var>
             and indexed by (F,P,D), into the output container <var><b>outVals</b></var>,
             defined on cells in physical space and indexed by (C,F,P,D).

             Computes pullback of \e HDIV functions 
             \f$\Phi^*(\widehat{\bf u}_f) = \left(J^{-1}_{c} DF_{c}\cdot\widehat{\bf u}_f\right)\circ F^{-1}_{c} \f$ 
             for points in one or more physical cells that are images of a given set of points in the reference cell:
      \f[
             \{ x_{c,p} \}_{p=0}^P = \{ F_{c} (\widehat{x}_p) \}_{p=0}^{P}\qquad 0\le c < C \,.
      \f]     
             In this case \f$ F^{-1}_{c}(x_{c,p}) = \widehat{x}_p \f$ and the user-provided container
             should contain the values of the vector function set \f$\{\widehat{\bf u}_f\}_{f=0}^{F}\f$ at the 
             reference points:
      \f[
             inVals(f,p,*) = \widehat{\bf u}_f(\widehat{x}_p) \,.
      \f]
             The method returns   
      \f[
             outVals(c,f,p,*) 
              = \left(J^{-1}_{c} DF_{c}\cdot \widehat{\bf u}_f\right)\circ F^{-1}_{c}(x_{c,p}) 
              = J^{-1}_{c}(\widehat{x}_p) DF_{c}(\widehat{x}_p)\cdot\widehat{\bf u}_f(\widehat{x}_p)
              \qquad 0\le c < C \,.
      \f]
             See Section \ref sec_pullbacks for more details about pullbacks.
    
    \code
    |------|----------------------|--------------------------------------------------|
    |      |         Index        |                   Dimension                      |
    |------|----------------------|--------------------------------------------------|
    |   C  |         cell         |  0 <= C < num. integration domains               |
    |   F  |         field        |  0 <= F < dim. of the basis                      |
    |   P  |         point        |  0 <= P < num. integration points                |
    |   D  |         space dim    |  0 <= D < spatial dimension                      |
    |------|----------------------|--------------------------------------------------|
    \endcode
  */
  template<class Scalar, class ArrayTypeOut, class ArrayTypeJac, class ArrayTypeDet, class ArrayTypeIn>
  static void HDIVtransformVALUE(ArrayTypeOut        & outVals,
                                 const ArrayTypeJac  & jacobian,
                                 const ArrayTypeDet  & jacobianDet,
                                 const ArrayTypeIn   & inVals,
                                 const char            transpose = 'N');
                                 /*
  template<class Scalar, class ArrayTypeOut, class ArrayTypeJac, class ArrayTypeDet, class ArrayTypeIn>
  static void HDIVtransformVALUETemp(ArrayTypeOut        & outVals,
                                 const ArrayTypeJac  & jacobian,
                                 const ArrayTypeDet  & jacobianDet,
                                 const ArrayTypeIn   & inVals,
                                 const char            transpose = 'N');*/
  /** \brief Transformation of a divergence field in the H-div space, defined at points on a
             reference cell, stored in the user-provided container <var><b>inVals</b></var>
             and indexed by (F,P), into the output container <var><b>outVals</b></var>,
             defined on cells in physical space and indexed by (C,F,P).

             Computes pullback of the divergence of \e HDIV functions 
             \f$\Phi^*(\widehat{\bf u}_f) = \left(J^{-1}_{c}\nabla\cdot\widehat{\bf u}_{f}\right) \circ F^{-1}_{c} \f$ 
             for points in one or more physical cells that are images of a given set of points in the reference cell:
      \f[
             \{ x_{c,p} \}_{p=0}^P = \{ F_{c} (\widehat{x}_p) \}_{p=0}^{P}\qquad 0\le c < C \,.
      \f]     
             In this case \f$ F^{-1}_{c}(x_{c,p}) = \widehat{x}_p \f$ and the user-provided container
             should contain the divergencies of the vector function set \f$\{\widehat{\bf u}_f\}_{f=0}^{F}\f$ at the 
             reference points:
      \f[
             inVals(f,p) = \nabla\cdot\widehat{\bf u}_f(\widehat{x}_p) \,.
      \f]
             The method returns   
      \f[
             outVals(c,f,p,*) 
                = \left(J^{-1}_{c}\nabla\cdot\widehat{\bf u}_{f}\right) \circ F^{-1}_{c} (x_{c,p}) 
                = J^{-1}_{c}(\widehat{x}_p) \nabla\cdot\widehat{\bf u}_{f} (\widehat{x}_p)
                \qquad 0\le c < C \,.
      \f]
             See Section \ref sec_pullbacks for more details about pullbacks.
    
    \code
    |------|----------------------|--------------------------------------------------|
    |      |         Index        |                   Dimension                      |
    |------|----------------------|--------------------------------------------------|
    |   C  |         cell         |  0 <= C < num. integration domains               |
    |   F  |         field        |  0 <= F < dim. of the basis                      |
    |   P  |         point        |  0 <= P < num. integration points                |
    |------|----------------------|--------------------------------------------------|
    \endcode
  */
  template<class Scalar, class ArrayTypeOut, class ArrayTypeDet, class ArrayTypeIn>
  static void HDIVtransformDIV(ArrayTypeOut        & outVals,
                               const ArrayTypeDet  & jacobianDet,
                               const ArrayTypeIn   & inVals);
                               /*
  template<class Scalar, class ArrayTypeOut, class ArrayTypeDet, class ArrayTypeIn>
  static void HDIVtransformDIVTemp(ArrayTypeOut        & outVals,
                               const ArrayTypeDet  & jacobianDet,
                               const ArrayTypeIn   & inVals);                               
*/
  /** \brief Transformation of a (scalar) value field in the H-vol space, defined at points on a
             reference cell, stored in the user-provided container <var><b>inVals</b></var>
             and indexed by (F,P), into the output container <var><b>outVals</b></var>,
             defined on cells in physical space and indexed by (C,F,P).

             Computes pullback of \e HVOL functions 
             \f$\Phi^*(\widehat{u}_f) = \left(J^{-1}_{c}\widehat{u}_{f}\right) \circ F^{-1}_{c} \f$ 
             for points in one or more physical cells that are images of a given set of points in the reference cell:
      \f[
             \{ x_{c,p} \}_{p=0}^P = \{ F_{c} (\widehat{x}_p) \}_{p=0}^{P}\qquad 0\le c < C \,.
      \f]     
             In this case \f$ F^{-1}_{c}(x_{c,p}) = \widehat{x}_p \f$ and the user-provided container
             should contain the values of the functions in the set \f$\{\widehat{\bf u}_f\}_{f=0}^{F}\f$ at the 
             reference points:
      \f[
             inVals(f,p) = \widehat{u}_f(\widehat{x}_p) \,.
      \f]
             The method returns   
      \f[
             outVals(c,f,p,*) 
                = \left(J^{-1}_{c}\widehat{u}_{f}\right) \circ F^{-1}_{c} (x_{c,p}) 
                = J^{-1}_{c}(\widehat{x}_p) \widehat{u}_{f} (\widehat{x}_p)
                \qquad 0\le c < C \,.
      \f]
             See Section \ref sec_pullbacks for more details about pullbacks.
    
    \code
    |------|----------------------|--------------------------------------------------|
    |      |         Index        |                   Dimension                      |
    |------|----------------------|--------------------------------------------------|
    |   C  |         cell         |  0 <= C < num. integration domains               |
    |   F  |         field        |  0 <= F < dim. of the basis                      |
    |   P  |         point        |  0 <= P < num. integration points                |
    |------|----------------------|--------------------------------------------------|
    \endcode
  */
  template<class Scalar, class ArrayTypeOut, class ArrayTypeDet, class ArrayTypeIn>
  static void HVOLtransformVALUE(ArrayTypeOut        & outVals,
                                 const ArrayTypeDet  & jacobianDet,
                                 const ArrayTypeIn   & inVals);

  /** \brief   Contracts \a <b>leftValues</b> and \a <b>rightValues</b> arrays on the
               point and possibly space dimensions and stores the result in \a <b>outputValues</b>;
               this is a generic, high-level integration routine that calls either
               FunctionSpaceTools::operatorIntegral, or FunctionSpaceTools::functionalIntegral,
               or FunctionSpaceTools::dataIntegral methods, depending on the rank of the
               \a <b>outputValues</b> array.

        \param  outputValues   [out] - Output array.
        \param  leftValues      [in] - Left input array.
        \param  rightValues     [in] - Right input array.
        \param  compEngine      [in] - Computational engine.
        \param  sumInto         [in] - If TRUE, sum into given output array,
                                       otherwise overwrite it. Default: FALSE.
  */
  template<class Scalar>
  static void integrate(Intrepid::FieldContainer<Scalar>            & outputValues,
                                   const Intrepid::FieldContainer<Scalar>   & leftValues,
                                   const Intrepid::FieldContainer<Scalar>  & rightValues,
                                   const ECompEngine           compEngine,
                                   const bool            sumInto = false);

  template<class Scalar, class ArrayOut, class ArrayInLeft, class ArrayInRight>
  static void integrate(ArrayOut            & outputValues,
                        const ArrayInLeft   & leftValues,
                        const ArrayInRight  & rightValues,
                        const ECompEngine     compEngine,
                        const bool            sumInto = false);
    
  /*  template<class Scalar, class ArrayOut, class ArrayInLeft, class ArrayInRight>
    static void integrateTemp(ArrayOut            & outputValues,
                          const ArrayInLeft   & leftValues,
                          const ArrayInRight  & rightValues,
                          const ECompEngine     compEngine,
                          const bool            sumInto = false);
                          */
    template<class Scalar, class ArrayOut, class ArrayInLeft, class ArrayInRight,int leftrank,int outrank>
    struct integrateTempSpec;

  /** \brief   Contracts the point (and space) dimensions P (and D1 and D2) of
               two rank-3, 4, or 5 containers with dimensions (C,L,P) and (C,R,P),
               or (C,L,P,D1) and (C,R,P,D1), or (C,L,P,D1,D2) and (C,R,P,D1,D2),
               and returns the result in a rank-3 container with dimensions (C,L,R).

               For a fixed index "C", (C,L,R) represents a rectangular L X R matrix
               where L and R may be different.
        \code
          C - num. integration domains       dim0 in both input containers
          L - num. "left" fields             dim1 in "left" container
          R - num. "right" fields            dim1 in "right" container
          P - num. integration points        dim2 in both input containers
          D1- vector (1st tensor) dimension  dim3 in both input containers
          D2- 2nd tensor dimension           dim4 in both input containers
        \endcode

        \param  outputFields   [out] - Output array.
        \param  leftFields      [in] - Left input array.
        \param  rightFields     [in] - Right input array.
        \param  compEngine      [in] - Computational engine.
        \param  sumInto         [in] - If TRUE, sum into given output array,
                                       otherwise overwrite it. Default: FALSE.
  */
  template<class Scalar, class ArrayOutFields, class ArrayInFieldsLeft, class ArrayInFieldsRight>
  static void operatorIntegral(ArrayOutFields &            outputFields,
                               const ArrayInFieldsLeft &   leftFields,
                               const ArrayInFieldsRight &  rightFields,
                               const ECompEngine           compEngine,
                               const bool                  sumInto = false);
/* template<class Scalar, class ArrayOutFields, class ArrayInFieldsLeft, class ArrayInFieldsRight>
  static void operatorIntegralTemp(ArrayOutFields &            outputFields,
                               const ArrayInFieldsLeft &   leftFields,
                               const ArrayInFieldsRight &  rightFields,
                               const ECompEngine           compEngine,
                               const bool                  sumInto = false);*/
 /** \brief    Contracts the point (and space) dimensions P (and D1 and D2) of a
               rank-3, 4, or 5 container and a rank-2, 3, or 4 container, respectively,
               with dimensions (C,F,P) and (C,P), or (C,F,P,D1) and (C,P,D1),
               or (C,F,P,D1,D2) and (C,P,D1,D2), respectively, and returns the result
               in a rank-2 container with dimensions (C,F).

               For a fixed index "C", (C,F) represents a (column) vector of length F.
        \code
          C  - num. integration domains                       dim0 in both input containers
          F  - num. fields                                    dim1 in fields input container
          P  - num. integration points                        dim2 in fields input container and dim1 in tensor data container
          D1 - first spatial (tensor) dimension index         dim3 in fields input container and dim2 in tensor data container
          D2 - second spatial (tensor) dimension index        dim4 in fields input container and dim3 in tensor data container
        \endcode

        \param  outputFields   [out] - Output fields array.
        \param  inputData       [in] - Data array.
        \param  inputFields     [in] - Input fields array.
        \param  compEngine      [in] - Computational engine.
        \param  sumInto         [in] - If TRUE, sum into given output array,
                                       otherwise overwrite it. Default: FALSE.
  */
  template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
  static void functionalIntegral(ArrayOutFields &       outputFields,
                                 const ArrayInData &    inputData,
                                 const ArrayInFields &  inputFields,
                                 const ECompEngine      compEngine,
                                 const bool             sumInto = false);
 /*   template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
  static void functionalIntegralTemp(ArrayOutFields &       outputFields,
                                 const ArrayInData &    inputData,
                                 const ArrayInFields &  inputFields,
                                 const ECompEngine      compEngine,
                                 const bool             sumInto = false);
*/
  /** \brief   Contracts the point (and space) dimensions P (and D1 and D2) of two
               rank-2, 3, or 4 containers with dimensions (C,P), or (C,P,D1), or
               (C,P,D1,D2), respectively, and returns the result in a rank-1 container
               with dimensions (C).

        \code
          C - num. integration domains                     dim0 in both input containers
          P - num. integration points                      dim1 in both input containers
          D1 - first spatial (tensor) dimension index      dim2 in both input containers
          D2 - second spatial (tensor) dimension index     dim3 in both input containers
        \endcode

        \param  outputData     [out] - Output data array.
        \param  inputDataLeft   [in] - Left data input array.
        \param  inputDataRight  [in] - Right data input array.
        \param  compEngine      [in] - Computational engine.
        \param  sumInto         [in] - If TRUE, sum into given output array,
                                       otherwise overwrite it. Default: FALSE.
  */
  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
  static void dataIntegral(ArrayOutData &            outputData,
                           const ArrayInDataLeft &   inputDataLeft,
                           const ArrayInDataRight &  inputDataRight,
                           const ECompEngine         compEngine,
                           const bool                sumInto = false);
   /* template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
  static void dataIntegralTemp(ArrayOutData &            outputData,
                           const ArrayInDataLeft &   inputDataLeft,
                           const ArrayInDataRight &  inputDataRight,
                           const ECompEngine         compEngine,
                           const bool                sumInto = false);
*/
  /** \brief   Returns the weighted integration measures \a <b>outVals</b> with dimensions
               (C,P) used for the computation of cell integrals, by multiplying absolute values 
               of the user-provided cell Jacobian determinants \a <b>inDet</b> with dimensions (C,P) 
               with the user-provided integration weights \a <b>inWeights</b> with dimensions (P).

               Returns a rank-2 array (C, P) array such that
        \f[
               \mbox{outVals}(c,p)   = |\mbox{det}(DF_{c}(\widehat{x}_p))|\omega_{p} \,,
        \f]
               where \f$\{(\widehat{x}_p,\omega_p)\}\f$ is a cubature rule defined on a reference cell
               (a set of integration points and their associated weights; see
               Intrepid::Cubature::getCubature for getting cubature rules on reference cells). 
        \warning 
               The user is responsible for providing input arrays with consistent data: the determinants
               in \a <b>inDet</b> should be evaluated at integration points on the <b>reference cell</b> 
               corresponding to the weights in \a <b>inWeights</b>.
 
        \remark
               See Intrepid::CellTools::setJacobian for computation of \e DF and 
               Intrepid::CellTools::setJacobianDet for computation of its determinant.

        \code
          C - num. integration domains                     dim0 in all containers
          P - num. integration points                      dim1 in all containers
        \endcode

        \param  outVals     [out] - Output array with weighted cell measures.
        \param  inDet        [in] - Input array containing determinants of cell Jacobians.
        \param  inWeights    [in] - Input integration weights.
  */
  template<class Scalar, class ArrayOut, class ArrayDet, class ArrayWeights>
  static void computeCellMeasure(ArrayOut             & outVals,
                                 const ArrayDet       & inDet,
                                 const ArrayWeights   & inWeights);

  /*template<class Scalar, class ArrayOut, class ArrayDet, class ArrayWeights>
  static void computeCellMeasureTemp(ArrayOut             & outVals,
                                 const ArrayDet       & inDet,
                                 const ArrayWeights   & inWeights);*/
  /** \brief   Returns the weighted integration measures \a <b>outVals</b> with dimensions
               (C,P) used for the computation of face integrals, based on the provided
               cell Jacobian array \a <b>inJac</b> with dimensions (C,P,D,D) and the
               provided integration weights \a <b>inWeights</b> with dimensions (P). 

               Returns a rank-2 array (C, P) array such that
      \f[
               \mbox{outVals}(c,p)   = 
                \left\|\frac{\partial\Phi_c(\widehat{x}_p)}{\partial u}\times 
                       \frac{\partial\Phi_c(\widehat{x}_p)}{\partial v}\right\|\omega_{p} \,,
      \f]
               where: 
      \li      \f$\{(\widehat{x}_p,\omega_p)\}\f$ is a cubature rule defined on \b reference 
               \b face \f$\widehat{\mathcal{F}}\f$, with ordinal \e whichFace relative to the specified parent reference cell;
      \li      \f$ \Phi_c : R \mapsto \mathcal{F} \f$ is parameterization of the physical face
               corresponding to \f$\widehat{\mathcal{F}}\f$; see Section \ref sec_cell_topology_subcell_map.
    
      \warning 
               The user is responsible for providing input arrays with consistent data: the Jacobians
               in \a <b>inJac</b> should be evaluated at integration points on the <b>reference face</b>
               corresponding to the weights in \a <b>inWeights</b>.
    
      \remark 
              Cubature rules on reference faces are defined by a two-step process:
      \li     A cubature rule is defined on the parametrization domain \e R of the face 
              (\e R is the standard 2-simplex {(0,0),(1,0),(0,1)} or the standard 2-cube [-1,1] X [-1,1]).
      \li     The points are mapped to a reference face using Intrepid::CellTools::mapToReferenceSubcell

      \remark
               See Intrepid::CellTools::setJacobian for computation of \e DF and 
               Intrepid::CellTools::setJacobianDet for computation of its determinant.
    
        \code
          C - num. integration domains                     dim0 in all input containers
          P - num. integration points                      dim1 in all input containers
          D - spatial dimension                            dim2 and dim3 in Jacobian container
        \endcode

        \param  outVals     [out] - Output array with weighted face measures.
        \param  inJac        [in] - Input array containing cell Jacobians.
        \param  inWeights    [in] - Input integration weights.
        \param  whichFace    [in] - Index of the face subcell relative to the parent cell; defines the domain of integration.
        \param  parentCell   [in] - Parent cell topology.
  */
  template<class Scalar, class ArrayOut, class ArrayJac, class ArrayWeights>
  static void computeFaceMeasure(ArrayOut                   & outVals,
                                 const ArrayJac             & inJac,
                                 const ArrayWeights         & inWeights,
                                 const int                    whichFace,
                                 const shards::CellTopology & parentCell);

/*  template<class Scalar, class ArrayOut, class ArrayJac, class ArrayWeights>
  static void computeFaceMeasureTemp(ArrayOut                   & outVals,
                                 const ArrayJac             & inJac,
                                 const ArrayWeights         & inWeights,
                                 const int                    whichFace,
                                 const shards::CellTopology & parentCell);*/
  /** \brief   Returns the weighted integration measures \a <b>outVals</b> with dimensions
               (C,P) used for the computation of edge integrals, based on the provided
               cell Jacobian array \a <b>inJac</b> with dimensions (C,P,D,D) and the
               provided integration weights \a <b>inWeights</b> with dimensions (P). 

               Returns a rank-2 array (C, P) array such that
      \f[
               \mbox{outVals}(c,p)   = 
                    \left\|\frac{d \Phi_c(\widehat{x}_p)}{d s}\right\|\omega_{p} \,,
      \f]
               where: 
      \li      \f$\{(\widehat{x}_p,\omega_p)\}\f$ is a cubature rule defined on \b reference 
               \b edge \f$\widehat{\mathcal{E}}\f$, with ordinal \e whichEdge relative to the specified parent reference cell;
      \li      \f$ \Phi_c : R \mapsto \mathcal{E} \f$ is parameterization of the physical edge
               corresponding to \f$\widehat{\mathcal{E}}\f$; see Section \ref sec_cell_topology_subcell_map.
    
      \warning 
               The user is responsible for providing input arrays with consistent data: the Jacobians
               in \a <b>inJac</b> should be evaluated at integration points on the <b>reference edge</b>
               corresponding to the weights in \a <b>inWeights</b>.
    
      \remark 
               Cubature rules on reference edges are defined by a two-step process:
      \li      A cubature rule is defined on the parametrization domain \e R = [-1,1] of the edge. 
      \li      The points are mapped to a reference edge using Intrepid::CellTools::mapToReferenceSubcell
    
      \remark
               See Intrepid::CellTools::setJacobian for computation of \e DF and 
               Intrepid::CellTools::setJacobianDet for computation of its determinant.

        \code
          C - num. integration domains                     dim0 in all input containers
          P - num. integration points                      dim1 in all input containers
          D - spatial dimension                            dim2 and dim3 in Jacobian container
        \endcode

        \param  outVals     [out] - Output array with weighted edge measures.
        \param  inJac        [in] - Input array containing cell Jacobians.
        \param  inWeights    [in] - Input integration weights.
        \param  whichEdge    [in] - Index of the edge subcell relative to the parent cell; defines the domain of integration.
        \param  parentCell   [in] - Parent cell topology.
  */
  template<class Scalar, class ArrayOut, class ArrayJac, class ArrayWeights>
  static void computeEdgeMeasure(ArrayOut                   & outVals,
                                 const ArrayJac             & inJac,
                                 const ArrayWeights         & inWeights,
                                 const int                    whichEdge,
                                 const shards::CellTopology & parentCell);

/*  template<class Scalar, class ArrayOut, class ArrayJac, class ArrayWeights>
  static void computeEdgeMeasureTemp(ArrayOut                   & outVals,
                                 const ArrayJac             & inJac,
                                 const ArrayWeights         & inWeights,
                                 const int                    whichEdge,
                                 const shards::CellTopology & parentCell);*/
  /** \brief   Multiplies fields \a <b>inVals</b> by weighted measures \a <b>inMeasure</b> and
               returns the field array \a <b>outVals</b>; this is a simple redirection to the call
               FunctionSpaceTools::scalarMultiplyDataField.

        \param  outVals     [out] - Output array with scaled field values.
        \param  inMeasure    [in] - Input array containing weighted measures.
        \param  inVals       [in] - Input fields.
  */
  template<class Scalar, class ArrayTypeOut, class ArrayTypeMeasure, class ArrayTypeIn>
  static void multiplyMeasure(ArrayTypeOut             & outVals,
                              const ArrayTypeMeasure   & inMeasure,
                              const ArrayTypeIn        & inVals);
 /*   template<class Scalar, class ArrayTypeOut, class ArrayTypeMeasure, class ArrayTypeIn>
  static void multiplyMeasureTemp(ArrayTypeOut             & outVals,
                              const ArrayTypeMeasure   & inMeasure,
                              const ArrayTypeIn        & inVals);*/
  /** \brief Scalar multiplication of data and fields; please read the description below.
             
             There are two use cases:
             \li
             multiplies a rank-3, 4, or 5 container \a <b>inputFields</b> with dimensions (C,F,P),
             (C,F,P,D1) or (C,F,P,D1,D2), representing the values of a set of scalar, vector
             or tensor fields, by the values in a rank-2 container \a <b>inputData</b> indexed by (C,P),
             representing the values of scalar data, OR
             \li
             multiplies a rank-2, 3, or 4 container \a <b>inputFields</b> with dimensions (F,P),
             (F,P,D1) or (F,P,D1,D2), representing the values of a scalar, vector or a
             tensor field, by the values in a rank-2 container \a <b>inputData</b> indexed by (C,P),
             representing the values of scalar data;
             the output value container \a <b>outputFields</b> is indexed by (C,F,P), (C,F,P,D1)
             or (C,F,P,D1,D2), regardless of which of the two use cases is considered.

      \code
        C  - num. integration domains
        F  - num. fields
        P  - num. integration points
        D1 - first spatial (tensor) dimension index
        D2 - second spatial (tensor) dimension index
      \endcode

      \note   The argument <var><b>inputFields</b></var> can be changed!
              This enables in-place multiplication.

      \param  outputFields   [out] - Output (product) fields array.
      \param  inputData       [in] - Data (multiplying) array.
      \param  inputFields     [in] - Input (being multiplied) fields array.
      \param  reciprocal      [in] - If TRUE, <b>divides</b> input fields by the data
                                     (instead of multiplying). Default: FALSE.
  */
  template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
  static void scalarMultiplyDataField(ArrayOutFields &     outputFields,
                                      ArrayInData &        inputData,
                                      ArrayInFields &      inputFields,
                                      const bool           reciprocal = false);

  /** \brief Scalar multiplication of data and data; please read the description below.

             There are two use cases:
             \li
             multiplies a rank-2, 3, or 4 container \a <b>inputDataRight</b> with dimensions (C,P),
             (C,P,D1) or (C,P,D1,D2), representing the values of a set of scalar, vector
             or tensor data, by the values in a rank-2 container \a <b>inputDataLeft</b> indexed by (C,P),
             representing the values of scalar data, OR
             \li
             multiplies a rank-1, 2, or 3 container \a <b>inputDataRight</b> with dimensions (P),
             (P,D1) or (P,D1,D2), representing the values of scalar, vector or
             tensor data, by the values in a rank-2 container \a <b>inputDataLeft</b> indexed by (C,P),
             representing the values of scalar data;
             the output value container \a <b>outputData</b> is indexed by (C,P), (C,P,D1) or (C,P,D1,D2),
             regardless of which of the two use cases is considered.

      \code
        C  - num. integration domains
        P  - num. integration points
        D1 - first spatial (tensor) dimension index
        D2 - second spatial (tensor) dimension index
      \endcode

      \note   The arguments <var><b>inputDataLeft</b></var>, <var><b>inputDataRight</b></var> can be changed!
              This enables in-place multiplication.

      \param  outputData      [out] - Output data array.
      \param  inputDataLeft    [in] - Left (multiplying) data array.
      \param  inputDataRight   [in] - Right (being multiplied) data array.
      \param  reciprocal       [in] - If TRUE, <b>divides</b> input fields by the data
                                      (instead of multiplying). Default: FALSE.
  */
  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
  static void scalarMultiplyDataData(ArrayOutData &           outputData,
                                     ArrayInDataLeft &        inputDataLeft,
                                     ArrayInDataRight &       inputDataRight,
                                     const bool               reciprocal = false);

  /** \brief Dot product of data and fields; please read the description below.
             
             There are two use cases:
             \li
             dot product of a rank-3, 4 or 5 container \a <b>inputFields</b> with dimensions (C,F,P)
             (C,F,P,D1) or (C,F,P,D1,D2), representing the values of a set of scalar, vector
             or tensor fields, by the values in a rank-2, 3 or 4 container \a <b>inputData</b> indexed by
             (C,P), (C,P,D1), or (C,P,D1,D2) representing the values of scalar, vector or
             tensor data, OR
             \li
             dot product of a rank-2, 3 or 4 container \a <b>inputFields</b> with dimensions (F,P),
             (F,P,D1) or (F,P,D1,D2), representing the values of a scalar, vector or tensor
             field, by the values in a rank-2 container \a <b>inputData</b> indexed by (C,P), (C,P,D1) or
             (C,P,D1,D2), representing the values of scalar, vector or tensor data;
             the output value container \a <b>outputFields</b> is indexed by (C,F,P),
             regardless of which of the two use cases is considered.

             For input fields containers without a dimension index, this operation reduces to
             scalar multiplication.
      \code
        C  - num. integration domains
        F  - num. fields
        P  - num. integration points
        D1 - first spatial (tensor) dimension index
        D2 - second spatial (tensor) dimension index
      \endcode

      \param  outputFields   [out] - Output (dot product) fields array.
      \param  inputData       [in] - Data array.
      \param  inputFields     [in] - Input fields array.
  */
  template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
  static void dotMultiplyDataField(ArrayOutFields &       outputFields,
                                   const ArrayInData &    inputData,
                                   const ArrayInFields &  inputFields);

  /** \brief Dot product of data and data; please read the description below.

             There are two use cases:
             \li
             dot product of a rank-2, 3 or 4 container \a <b>inputDataRight</b> with dimensions (C,P)
             (C,P,D1) or (C,P,D1,D2), representing the values of a scalar, vector or a
             tensor set of data, by the values in a rank-2, 3 or 4 container \a <b>inputDataLeft</b> indexed by
             (C,P), (C,P,D1), or (C,P,D1,D2) representing the values of scalar, vector or
             tensor data, OR
             \li
             dot product of a rank-2, 3 or 4 container \a <b>inputDataRight</b> with dimensions (P),
             (P,D1) or (P,D1,D2), representing the values of scalar, vector or tensor
             data, by the values in a rank-2 container \a <b>inputDataLeft</b> indexed by (C,P), (C,P,D1) or
             (C,P,D1,D2), representing the values of scalar, vector, or tensor data;
             the output value container \a <b>outputData</b> is indexed by (C,P),
             regardless of which of the two use cases is considered.

             For input fields containers without a dimension index, this operation reduces to
             scalar multiplication.
      \code
        C  - num. integration domains
        P  - num. integration points
        D1 - first spatial (tensor) dimension index
        D2 - second spatial (tensor) dimension index
      \endcode

      \param  outputData      [out] - Output (dot product) data array.
      \param  inputDataLeft    [in] - Left input data array.
      \param  inputDataRight   [in] - Right input data array.
  */
  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
  static void dotMultiplyDataData(ArrayOutData &            outputData,
                                  const ArrayInDataLeft &   inputDataLeft,
                                  const ArrayInDataRight &  inputDataRight);

  /** \brief Cross or outer product of data and fields; please read the description below.

             There are four use cases:
             \li
             cross product of a rank-4 container \a <b>inputFields</b> with dimensions (C,F,P,D),
             representing the values of a set of vector fields, on the left by the values in a rank-3
             container \a <b>inputData</b> indexed by (C,P,D), representing the values of vector data, OR
             \li
             cross product of a rank-3 container \a <b>inputFields</b> with dimensions (F,P,D),
             representing the values of a vector field, on the left by the values in a rank-3 container
             \a <b>inputData</b> indexed by (C,P,D), representing the values of vector data, OR
             \li
             outer product of a rank-4 container \a <b>inputFields</b> with dimensions (C,F,P,D),
             representing the values of a set of vector fields, on the left by the values in a rank-3
             container \a <b>inputData</b> indexed by (C,P,D), representing the values of vector data, OR
             \li
             outer product of a rank-3 container \a <b>inputFields</b> with dimensions (F,P,D),
             representing the values of a vector field, on the left by the values in a rank-3 container
             \a <b>inputData</b> indexed by (C,P,D), representing the values of vector data;
             for cross products, the output value container \a <b>outputFields</b> is indexed by
             (C,F,P,D) in 3D (vector output) and by (C,F,P) in 2D (scalar output);
             for outer products, the output value container \a <b>outputFields</b> is indexed by (C,F,P,D,D).

      \code
        C  - num. integration domains
        F  - num. fields
        P  - num. integration points
        D  - spatial dimension, must be 2 or 3
      \endcode

      \param  outputFields   [out] - Output (cross or outer product) fields array.
      \param  inputData       [in] - Data array.
      \param  inputFields     [in] - Input fields array.
  */
  template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
  static void vectorMultiplyDataField(ArrayOutFields &       outputFields,
                                      const ArrayInData &    inputData,
                                      const ArrayInFields &  inputFields);

  /** \brief Cross or outer product of data and data; please read the description below.

             There are four use cases:
             \li
             cross product of a rank-3 container \a <b>inputDataRight</b> with dimensions (C,P,D),
             representing the values of a set of vector data, on the left by the values in a rank-3
             container \a <b>inputDataLeft</b> indexed by (C,P,D) representing the values of vector data, OR
             \li
             cross product of a rank-2 container \a <b>inputDataRight</b> with dimensions (P,D),
             representing the values of vector data, on the left by the values in a rank-3 container
             \a <b>inputDataLeft</b> indexed by (C,P,D), representing the values of vector data, OR
             \li
             outer product of a rank-3 container \a <b>inputDataRight</b> with dimensions (C,P,D),
             representing the values of a set of vector data, on the left by the values in a rank-3
             container \a <b>inputDataLeft</b> indexed by (C,P,D) representing the values of vector data, OR
             \li
             outer product of a rank-2 container \a <b>inputDataRight</b> with dimensions (P,D),
             representing the values of vector data, on the left by the values in a rank-3 container
             \a <b>inputDataLeft</b> indexed by (C,P,D), representing the values of vector data;
             for cross products, the output value container \a <b>outputData</b> is indexed by
             (C,P,D) in 3D (vector output) and by (C,P) in 2D (scalar output);
             for outer products, the output value container \a <b>outputData</b> is indexed by (C,P,D,D).

      \code
        C  - num. integration domains
        P  - num. integration points
        D  - spatial dimension, must be 2 or 3
      \endcode

      \param  outputData      [out] - Output (cross or outer product) data array.
      \param  inputDataLeft    [in] - Left input data array.
      \param  inputDataRight   [in] - Right input data array.
  */
  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
  static void vectorMultiplyDataData(ArrayOutData &            outputData,
                                     const ArrayInDataLeft &   inputDataLeft,
                                     const ArrayInDataRight &  inputDataRight);

  /** \brief Matrix-vector or matrix-matrix product of data and fields; please read the description below.

             There are four use cases:
             \li
             matrix-vector product of a rank-4 container \a <b>inputFields</b> with dimensions (C,F,P,D),
             representing the values of a set of vector fields, on the left by the values in a rank-2, 3, or 4
             container \a <b>inputData</b> indexed by (C,P), (C,P,D) or (C,P,D,D), respectively,
             representing the values of tensor data, OR
             \li
             matrix-vector product of a rank-3 container \a <b>inputFields</b> with dimensions (F,P,D),
             representing the values of a vector field, on the left by the values in a rank-2, 3, or 4
             container \a <b>inputData</b> indexed by (C,P), (C,P,D) or (C,P,D,D), respectively,
             representing the values of tensor data, OR
             \li
             matrix-matrix product of a rank-5 container \a <b>inputFields</b> with dimensions (C,F,P,D,D),
             representing the values of a set of tensor fields, on the left by the values in a rank-2, 3, or 4
             container \a <b>inputData</b> indexed by (C,P), (C,P,D) or (C,P,D,D), respectively,
             representing the values of tensor data, OR
             \li
             matrix-matrix product of a rank-4 container \a <b>inputFields</b> with dimensions (F,P,D,D),
             representing the values of a tensor field, on the left by the values in a rank-2, 3, or 4
             container \a <b>inputData</b> indexed by (C,P), (C,P,D) or (C,P,D,D), respectively,
             representing the values of tensor data;
             for matrix-vector products, the output value container \a <b>outputFields</b> is
             indexed by (C,F,P,D);
             for matrix-matrix products the output value container \a <b>outputFields</b> is
             indexed by (C,F,P,D,D).

      \remarks
             The rank of \a <b>inputData</b> implicitly defines the type of tensor data:
             \li rank = 2 corresponds to a constant diagonal tensor \f$ diag(a,\ldots,a) \f$
             \li rank = 3 corresponds to a nonconstant diagonal tensor \f$ diag(a_1,\ldots,a_d) \f$
             \li rank = 4 corresponds to a full tensor \f$ \{a_{ij}\}\f$

      \note  It is assumed that all tensors are square!

      \note  The method is defined for spatial dimensions D = 1, 2, 3

      \code
        C    - num. integration domains
        F    - num. fields
        P    - num. integration points
        D    - spatial dimension
      \endcode

      \param  outputFields   [out] - Output (matrix-vector or matrix-matrix product) fields array.
      \param  inputData       [in] - Data array.
      \param  inputFields     [in] - Input fields array.
      \param  transpose       [in] - If 'T', use transposed left data tensor; if 'N', no transpose. Default: 'N'.
  */
  template<class Scalar, class ArrayOutFields, class ArrayInData, class ArrayInFields>
  static void tensorMultiplyDataField(ArrayOutFields &       outputFields,
                                      const ArrayInData &    inputData,
                                      const ArrayInFields &  inputFields,
                                      const char             transpose = 'N');

  /** \brief Matrix-vector or matrix-matrix product of data and data; please read the description below.

             There are four use cases:
             \li
             matrix-vector product of a rank-3 container \a <b>inputDataRight</b> with dimensions (C,P,D),
             representing the values of a set of vector data, on the left by the values in a rank-2, 3, or 4
             container \a <b>inputDataLeft</b> indexed by (C,P), (C,P,D) or (C,P,D,D), respectively,
             representing the values of tensor data, OR
             \li
             matrix-vector product of a rank-2 container \a <b>inputDataRight</b> with dimensions (P,D),
             representing the values of vector data, on the left by the values in a rank-2, 3, or 4
             container \a <b>inputDataLeft</b> indexed by (C,P), (C,P,D) or (C,P,D,D), respectively,
             representing the values of tensor data, OR
             \li
             matrix-matrix product of a rank-4 container \a <b>inputDataRight</b> with dimensions (C,P,D,D),
             representing the values of a set of tensor data, on the left by the values in a rank-2, 3, or 4
             container \a <b>inputDataLeft</b> indexed by (C,P), (C,P,D) or (C,P,D,D), respectively,
             representing the values of tensor data, OR
             \li
             matrix-matrix product of a rank-3 container \a <b>inputDataRight</b> with dimensions (P,D,D),
             representing the values of tensor data, on the left by the values in a rank-2, 3, or 4
             container \a <b>inputDataLeft</b> indexed by (C,P), (C,P,D) or (C,P,D,D), respectively,
             representing the values of tensor data;
             for matrix-vector products, the output value container \a <b>outputData</b>
             is indexed by (C,P,D);
             for matrix-matrix products, the output value container \a <b>outputData</b>
             is indexed by (C,P,D1,D2).

      \remarks
            The rank of <b>inputDataLeft</b> implicitly defines the type of tensor data:
            \li rank = 2 corresponds to a constant diagonal tensor \f$ diag(a,\ldots,a) \f$
            \li rank = 3 corresponds to a nonconstant diagonal tensor \f$ diag(a_1,\ldots,a_d) \f$
            \li rank = 4 corresponds to a full tensor \f$ \{a_{ij}\}\f$

      \note  It is assumed that all tensors are square!

      \note  The method is defined for spatial dimensions D = 1, 2, 3

      \code
        C    - num. integration domains
        P    - num. integration points
        D    - spatial dimension
      \endcode

      \param  outputData      [out] - Output (matrix-vector product) data array.
      \param  inputDataLeft    [in] - Left input data array.
      \param  inputDataRight   [in] - Right input data array.
      \param  transpose        [in] - If 'T', use transposed tensor; if 'N', no transpose. Default: 'N'.
  */
  template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
  static void tensorMultiplyDataData(ArrayOutData &            outputData,
                                     const ArrayInDataLeft &   inputDataLeft,
                                     const ArrayInDataRight &  inputDataRight,
                                     const char                transpose = 'N');
                                     
/* template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight>
  static void tensorMultiplyDataDataTemp(ArrayOutData &            outputData,
                                     const ArrayInDataLeft &   inputDataLeft,
                                     const ArrayInDataRight &  inputDataRight,
                                     const char                transpose = 'N');
          */                           
   template<class Scalar, class ArrayOutData, class ArrayInDataLeft, class ArrayInDataRight,int outvalRank>
	struct tensorMultiplyDataDataTempSpec;
  /** \brief Applies left (row) signs, stored in the user-provided container
             <var><b>fieldSigns</b></var> and indexed by (C,L), to the operator
             <var><b>inoutOperator</b></var> indexed by (C,L,R).

             Mathematically, this method computes the matrix-matrix product
      \f[
             \mathbf{K}^{c} = \mbox{diag}(\sigma^c_0,\ldots,\sigma^c_{L-1}) \mathbf{K}^c 
      \f]
             where \f$\mathbf{K}^{c} \in \mathbf{R}^{L\times R}\f$ is array of matrices  indexed by 
             cell number \e c and stored in the rank-3 array \e inoutOperator, and 
             \f$\{\sigma^c_l\}_{l=0}^{L-1}\f$  is array of left field signs indexed by cell number \e c
             and stored in the rank-2 container \e fieldSigns;  
             see Section \ref sec_pullbacks for discussion of field signs. This operation is 
             required for operators generated by \e HCURL and \e HDIV-conforming vector-valued 
             finite element basis functions; see Sections \ref sec_pullbacks and Section 
             \ref sec_ops for applications of this method.
    
      \code
        C    - num. integration domains
        L    - num. left fields
        R    - num. right fields
      \endcode

      \param  inoutOperator [in/out] - Input / output operator array.
      \param  fieldSigns        [in] - Left field signs.
  */
  template<class Scalar, class ArrayTypeInOut, class ArrayTypeSign>
  static void applyLeftFieldSigns(ArrayTypeInOut        & inoutOperator,
                                  const ArrayTypeSign   & fieldSigns);

  /** \brief Applies right (column) signs, stored in the user-provided container
             <var><b>fieldSigns</b></var> and indexed by (C,R), to the operator
             <var><b>inoutOperator</b></var> indexed by (C,L,R).

             Mathematically, this method computes the matrix-matrix product
      \f[
             \mathbf{K}^{c} = \mathbf{K}^c \mbox{diag}(\sigma^c_0,\ldots,\sigma^c_{R-1})
      \f]
             where \f$\mathbf{K}^{c} \in \mathbf{R}^{L\times R}\f$ is array of matrices indexed by 
             cell number \e c and stored in the rank-3 container \e inoutOperator, and 
             \f$\{\sigma^c_r\}_{r=0}^{R-1}\f$ is array of right field signs indexed by cell number \e c
             and stored in the rank-2 container \e fieldSigns;  
             see Section \ref sec_pullbacks for discussion of field signs. This operation is 
             required for operators generated by \e HCURL and \e HDIV-conforming vector-valued 
             finite element basis functions; see Sections \ref sec_pullbacks and Section 
             \ref sec_ops for applications of this method.
    
      \code
        C    - num. integration domains
        L    - num. left fields
        R    - num. right fields
      \endcode

      \param  inoutOperator [in/out] - Input / output operator array.
      \param  fieldSigns        [in] - Right field signs.
  */
  template<class Scalar, class ArrayTypeInOut, class ArrayTypeSign>
  static void applyRightFieldSigns(ArrayTypeInOut        & inoutOperator,
                                   const ArrayTypeSign   & fieldSigns);

  /** \brief Applies field signs, stored in the user-provided container
             <var><b>fieldSigns</b></var> and indexed by (C,F), to the function
             <var><b>inoutFunction</b></var> indexed by (C,F), (C,F,P),
             (C,F,P,D1) or (C,F,P,D1,D2).

             Returns
      \f[    
             \mbox{inoutFunction}(c,f,*) = \mbox{fieldSigns}(c,f)*\mbox{inoutFunction}(c,f,*)
      \f]
             See Section \ref sec_pullbacks for discussion of field signs. 

      \code
        C    - num. integration domains
        F    - num. fields
        P    - num. integration points
        D1   - spatial dimension
        D2   - spatial dimension
      \endcode

      \param  inoutFunction [in/out] - Input / output function array.
      \param  fieldSigns        [in] - Right field signs.
  */
  template<class Scalar, class ArrayTypeInOut, class ArrayTypeSign>
  static void applyFieldSigns(ArrayTypeInOut        & inoutFunction,
                              const ArrayTypeSign   & fieldSigns);
 /* template<class Scalar, class ArrayTypeInOut, class ArrayTypeSign>
  static void applyFieldSignsTemp(ArrayTypeInOut        & inoutFunction,
                              const ArrayTypeSign   & fieldSigns);
*/
  /** \brief Computes point values \a <b>outPointVals</b> of a discrete function
             specified by the basis \a <b>inFields</b> and coefficients
             \a <b>inCoeffs</b>.

             The array \a <b>inFields</b> with dimensions (C,F,P), (C,F,P,D1),
             or (C,F,P,D1,D2) represents the signed, transformed field (basis) values at
             points in REFERENCE frame; the \a <b>outPointVals</b> array with
             dimensions (C,P), (C,P,D1), or (C,P,D1,D2), respectively, represents
             values of a discrete function at points in PHYSICAL frame.
             The array \a <b>inCoeffs</b> dimensioned (C,F) supplies the coefficients
             for the field (basis) array.
   
             Returns rank-2,3 or 4 array such that
      \f[
             outPointValues(c,p,*) = \sum_{f=0}^{F-1} \sigma_{c,f} u_{c,f}(x_p)
      \f]
             where \f$\{u_{c,f}\}_{f=0}^{F-1} \f$ is scalar, vector or tensor valued finite element
             basis defined on physical cell \f$\mathcal{C}\f$ and \f$\{\sigma_{c,f}\}_{f=0}^{F-1} \f$
             are the field signs of the basis functions; see Section \ref sec_pullbacks. 
             This method implements the last step in a four step process; please see Section
             \ref sec_evaluate for details about the first three steps that prepare the 
             necessary data for this method. 

      \code
        C    - num. integration domains
        F    - num. fields
        P    - num. integration points
        D1   - spatial dimension
        D2   - spatial dimension
      \endcode

      \param  outPointVals [out] - Output point values of a discrete function.
      \param  inCoeffs      [in] - Coefficients associated with the fields (basis) array.
      \param  inFields      [in] - Field (basis) values.
  */
  template<class Scalar, class ArrayOutPointVals, class ArrayInCoeffs, class ArrayInFields>
  static void evaluate(ArrayOutPointVals     & outPointVals,
                       const ArrayInCoeffs   & inCoeffs,
                       const ArrayInFields   & inFields);
  
};  // end FunctionSpaceTools

} // end namespace Intrepid

// include templated definitions
#include <Intrepid_FunctionSpaceToolsDef.hpp>

#endif

/***************************************************************************************************
 **                                                                                               **
 **                           D O C U M E N T A T I O N   P A G E S                               **
 **                                                                                               **
 **************************************************************************************************/

/**
 \page    function_space_tools_page                 Function space tools
 
 <b>Table of contents </b>
 \li \ref sec_fst_overview 
 \li \ref sec_pullbacks
 \li \ref sec_measure
 \li \ref sec_evaluate
 
 \section sec_fst_overview                          Overview

 Intrepid::FunctionSpaceTools is a stateless class of \e expert \e methods for operations on finite
 element subspaces of \f$H(grad,\Omega)\f$, \f$H(curl,\Omega)\f$, \f$H(div,\Omega)\f$ and \f$L^2(\Omega)\f$.
 In Intrepid these spaces are referred to as \e HGRAD, \e HCURL, \e HDIV and \e HVOL. There are four 
 basic groups of methods:
 
 - Transformation methods provide implementation of pullbacks for \e HGRAD, \e HCURL, \e HDIV and \e HVOL 
   finite element functions. Thease are essentialy the "change of variables rules" needed to transform 
   values of basis functions and their derivatives defined on a reference element \f$\widehat{{\mathcal C}}\f$ 
   to a physical element \f${\mathcal C}\f$. See Section \ref sec_pullbacks for details
 - Measure computation methods implement the volume, surface and line measures required for computation
   of integrals in the physical frame by changing variables to reference frame. See Section \ref sec_measure
   for details.
 - Integration methods implement the algebraic operations to compute ubiquitous integrals of finite element 
   functions: integrals arising in bilinear forms and linear functionals.
 - Methods for algebraic and vector-algebraic operations on multi-dimensional arrays with finite element
   function values. These methods are used to prepare multidimensional arrays with data and finite
   element function values for the integration routines. They also include evaluation methods to compute
   finite element function values at some given points in physical frame; see Section \ref sec_evaluate.
 
 
 \section sec_pullbacks                             Pullbacks
 
 Notation in this section follows the standard definition of a finite element space by Ciarlet; see
 <var> The Finite Element Method for Elliptic Problems, Classics in Applied Mathematics, SIAM, 2002. </var>
 Given a reference cell \f$\{\widehat{{\mathcal C}},\widehat{P},\widehat{\Lambda}\}\f$ with a basis  
 \f$\{\widehat{u}_i\}_{i=0}^n\f$, the basis \f$\{{u}_i\}_{i=0}^n\f$ of  \f$\{{\mathcal C},P,\Lambda\}\f$ is defined 
 as follows:
 \f[
      u_i = \sigma_i \Phi^*(\widehat{u}_i), \qquad i=1,\ldots,n \,.
 \f]  
 In this formula \f$\{\sigma_i\}_{i=0}^n\f$, where \f$\sigma_i = \pm 1\f$, are the \e field \e signs, 
 and \f$\Phi^*\f$ is the \e pullback ("change of variables") transformation. For scalar spaces
 such as \e HGRAD and \e HVOL the field signs are always equal to 1 and can be disregarded. For vector
 field spaces such as \e HCURL or \e HDIV, the field sign of a basis function can be +1 or -1, 
 depending on the orientation of the physical edge or face, associated with the basis function.
  
 The actual form of the pullback depends on which one of the four function spaces \e HGRAD, \e HCURL, 
 \e HDIV and \e HVOL is being approximated and is computed as follows. Let \f$F_{\mathcal C}\f$ 
 denote the reference-to-physical map (see Section \ref sec_cell_topology_ref_map);
 \f$DF_{\mathcal C}\f$ is its Jacobian (see Section \ref sec_cell_topology_ref_map_DF) and 
 \f$J_{\mathcal C} = \det(DF_{\mathcal C})\f$. Then,
 \f[
    \begin{array}{ll}
      \Phi^*_G : HGRAD(\widehat{{\mathcal C}}) \mapsto HGRAD({\mathcal C})&
      \qquad \Phi^*_G(\widehat{u}) = \widehat{u}\circ F^{-1}_{\mathcal C} \\[2ex]
      \Phi^*_C : HCURL(\widehat{{\mathcal C}}) \mapsto HCURL({\mathcal C})&
      \qquad \Phi^*_C(\widehat{\bf u}) = \left((DF_{\mathcal C})^{-{\sf T}}\cdot\widehat{\bf u}\right)\circ F^{-1}_{\mathcal C} \\[2ex]
      \Phi^*_D : HDIV(\widehat{{\mathcal C}}) \mapsto HDIV({\mathcal C})&
      \qquad \Phi^*_D(\widehat{\bf u}) = \left(J^{-1}_{\mathcal C} DF_{\mathcal C}\cdot\widehat{\bf u}\right)\circ F^{-1}_{\mathcal C} 
      \\[2ex]
      \Phi^*_S : HVOL(\widehat{{\mathcal C}}) \mapsto HVOL({\mathcal C})&
      \qquad \Phi^*_S(\widehat{u}) = \left(J^{-1}_{\mathcal C} \widehat{u}\right) \circ F^{-1}_{\mathcal C} \,.
    \end{array}
 \f]
 Intrepid supports pullbacks only for cell topologies that have reference cells; see 
 \ref cell_topology_ref_cells.
 
 
 \section sec_measure                             Measure
 
 In Intrepid integrals of finite element functions over cells, 2-subcells (faces) and 1-subcells (edges) 
 are computed by change of variables to reference frame and require three  different kinds of measures. 
 
 -# The integral of a scalar function over a cell \f${\mathcal C}\f$
      \f[
          \int_{{\mathcal C}} f(x) dx = \int_{\widehat{{\mathcal C}}} f(F(\widehat{x})) |J | d\widehat{x}
      \f]
      requires the volume measure defined by the determinant of the Jacobian. This measure is computed 
      by Intrepid::FunctionSpaceTools::computeCellMeasure
 -# The integral of a scalar function over 2-subcell \f$\mathcal{F}\f$
      \f[
          \int_{\mathcal{F}} f(x) dx = \int_{R} f(\Phi(u,v)) 
          \left\|\frac{\partial\Phi}{\partial u}\times \frac{\partial\Phi}{\partial v}\right\| du\,dv
      \f]
      requires the surface measure defined by the norm of the vector product of the surface tangents. This   
      measure is computed by Intrepid::FunctionSpaceTools::computeFaceMeasure. In this formula \e R is the parametrization 
      domain for the 2-subcell; see Section \ref sec_cell_topology_subcell_map for details.
 -# The integral of a scalar function over a 1-subcell \f$\mathcal{E}\f$
      \f[
          \int_{\mathcal{E}} f(x) dx = \int_{R} f(\Phi(s)) \|\Phi'\| ds
      \f]
      requires the arc measure defined by the norm of the arc tangent vector. This measure is computed 
      by Intrepid::FunctionSpaceTools::computeEdgeMeasure. In this formula \e R is the parametrization 
      domain for the 1-subcell; see Section \ref sec_cell_topology_subcell_map for details.
 
 
 \section sec_evaluate                          Evaluation of finite element fields
 
 To make this example more specific, assume curl-conforming finite element spaces.
 Suppose that we have a physical cell \f$\{{\mathcal C},P,\Lambda\}\f$ with a basis
 \f$\{{\bf u}_i\}_{i=0}^n\f$. A finite element function on this cell is defined by a set of \e n
 coefficients \f$\{c_i\}_{i=0}^n\f$:
 \f[
      {\bf u}^h(x) = \sum_{i=0}^n c_i {\bf u}_i(x) \,.
 \f]
 
 From Section \ref sec_pullbacks it follows that
 \f[
      {\bf u}^h(x) = \sum_{i=0}^n c_i \sigma_i
               \left((DF_{\mathcal C})^{-{\sf T}}\cdot\widehat{\bf u}_i\right)\circ 
                     F^{-1}_{\mathcal C}(x) 
             = \sum_{i=0}^n c_i \sigma_i 
                    (DF_{\mathcal C}(\widehat{x}))^{-{\sf T}}\cdot\widehat{\bf u}_i(\widehat{x})\,,
 \f]
 where \f$ \widehat{x} = F^{-1}_{\mathcal C}(x) \in \widehat{\mathcal C} \f$ is the pre-image 
 of \e x in the reference cell. 
 
 Consequently, evaluation of finite element functions at a given set of points 
 \f$\{x_p\}_{p=0}^P \subset {\mathcal C}\f$ comprises of the following four steps:
 
 -#   Application of the inverse map \f$F^{-1}_{\mathcal C}\f$ to obtain the pre-images
      \f$\{\widehat{x}_p\}_{p=0}^P\f$ of the evaluation points in the reference cell 
      \f$\widehat{\mathcal{C}}\f$; see Intrepid::CellTools::mapToReferenceFrame
 -#   Evaluation of the appropriate reference basis set \f$\{\widehat{\bf u}_i\}_{i=1}^n\f$
      at the pre-image set \f$\{\widehat{x}_p\}_{p=0}^P\f$; see Intrepid::Basis::getValues
 -#   Application of the appropriate transformation and field signs. In our example the finite
      element space is curl-conforming and the appropriate transformation is implemented in
      Intrepid::FunctionSpaceTools::HCURLtransformVALUE. Application of the signs to the
      transformed functions is done by Intrepid::FunctionSpaceTools::applyFieldSigns.
 -#   The final step is to compute the sum of the transformed and signed basis function values
      multiplied by the coefficients of the finite element function using 
      Intrepid::FunctionSpaceTools::evaluate.
 

 Evaluation of adimssible derivatives of finite element functions is completely analogous 
 and follows the same four steps. Evaluation of scalar finite element functions is simpler
 because application of the signes can be skipped for these functions. 
 
 
 
 \section sec_ops                          Evaluation of finite element operators and functionals
 
 Assume the same setting as in Section \ref sec_evaluate. A finite element operator defined 
 by the finite element basis on the physical cell \f$\mathcal{C}\f$ is a matrix
 \f[
      \mathbf{K}^{\mathcal{C}}_{i,j} = \int_{\mathcal C} {\mathcal L}_L {\bf u}_i(x)\, {\mathcal L}_R {\bf u}_j(x) \, dx \,.
 \f]
 where \f${\mathcal L}_L\f$ and \f${\mathcal L}_R \f$ are \e left and \e right operators acting on the basis
 functions. Typically, when the left and the right basis functions are from the same finite
 element basis (as in this example), the left and right operators are the same. If they are set
 to \e VALUE we get a mass matrix; if they are set to an admissible differential operator we get
 a stiffnesss matrix. Assume again that the basis is curl-conforming and the operators are 
 set to \e VALUE. Using the basis definition from Section \ref sec_pullbacks we have that
 \f[
     \mathbf{K}^{\mathcal{C}}_{i,j} = \int_{\widehat{\mathcal C}} \sigma_i \sigma_j
     (DF_{\mathcal C}(\widehat{x}))^{-{\sf T}}\cdot\widehat{\bf u}_i(\widehat{x})\cdot
     (DF_{\mathcal C}(\widehat{x}))^{-{\sf T}}\cdot\widehat{\bf u}_i(\widehat{x})\,d\widehat{x}
 \f]
 It follows that 
 \f[
   \mathbf{K}^{\mathcal{C}}_{i,j} = 
   \mbox{diag}(\sigma_0,\ldots,\sigma_n)\widehat{\mathbf{K}}^{\mathcal{C}}\mbox{diag}(\sigma_0,\ldots,\sigma_n)
 \f]
where 
 \f[ 
   \widehat{\mathbf{K}}^{\mathcal{C}}_{i,j} = \int_{\widehat{\mathcal C}}
   (DF_{\mathcal C}(\widehat{x}))^{-{\sf T}}\cdot\widehat{\bf u}_i(\widehat{x})\cdot
   (DF_{\mathcal C}(\widehat{x}))^{-{\sf T}}\cdot\widehat{\bf u}_i(\widehat{x})\,d\widehat{x}
 \f]
 is the raw cell operator matrix. The methods Intrepid::FunctionSpaceTools::applyLeftFieldSigns and
 Intrepid::FunctionSpaceTools::applyRightFieldSigns apply the left and right diagonal sign matrices to
 the raw cell operator.

 
 A finite element operator defined by the finite element basis on the physical cell is a vector
 \f[
   \mathbf{f}^{\mathcal{C}}_{i} = \int_{\mathcal C} f(x) {\mathcal L}_R u_i(x) \, dx \,.
 \f]
 Assuming again operator \e VALUE and using the same arguments as above, we see that
 \f[
   \mathbf{f}^{\mathcal{C}} = 
      \mbox{diag}(\sigma_0,\ldots,\sigma_n)\widehat{\mathbf{f}}^{\mathcal{C}}\,,
 \f]
 where 
 \f[
   \widehat{\mathbf{f}}^{\mathcal{C}} = \int_{\widehat{\mathcal C}}
         \mathbf{f}\circ F_{\mathcal C}(\widehat{x}) 
         (DF_{\mathcal C}(\widehat{x}))^{-{\sf T}}\cdot\widehat{\bf u}_i(\widehat{x})\,d\widehat{x}
 \f]
 is the raw cell functional.
*/