File: test_05.hpp

package info (click to toggle)
trilinos 12.18.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 825,604 kB
  • sloc: cpp: 3,352,065; ansic: 432,926; fortran: 169,495; xml: 61,903; python: 40,836; sh: 32,697; makefile: 26,612; javascript: 8,535; perl: 7,136; f90: 6,372; csh: 4,183; objc: 2,620; lex: 1,469; lisp: 810; yacc: 497; awk: 364; ml: 281; php: 145
file content (726 lines) | stat: -rw-r--r-- 38,399 bytes parent folder | download
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
// @HEADER
// ************************************************************************
//
//                           Intrepid2 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 Kyungjoo Kim  (kyukim@sandia.gov), or
//                    Mauro Perego  (mperego@sandia.gov)
//
// ************************************************************************
// @HEADER


/** \file
    \brief  Test of the CellTools class.
    \author Created by P. Bochev, D. Ridzal, K. Peterson and Kyungjoo Kim
*/


#include "Intrepid2_config.h"

#ifdef HAVE_INTREPID2_DEBUG
#define INTREPID2_TEST_FOR_DEBUG_ABORT_OVERRIDE_TO_CONTINUE
#endif

#include "Intrepid2_Types.hpp"
#include "Intrepid2_Utils.hpp"

#include "Intrepid2_CellTools.hpp"

#include "Teuchos_oblackholestream.hpp"
#include "Teuchos_RCP.hpp"


namespace Intrepid2 {

  namespace Test {
#define INTREPID2_TEST_ERROR_EXPECTED( S )                              \
    try {                                                               \
      ++nthrow;                                                         \
      S ;                                                               \
    }                                                                   \
    catch (std::exception err) {                                      \
      ++ncatch;                                                         \
      *outStream << "Expected Error ----------------------------------------------------------------\n"; \
      *outStream << err.what() << '\n';                                 \
      *outStream << "-------------------------------------------------------------------------------" << "\n\n"; \
    };
#define ConstructWithLabel(obj, ...) obj(#obj, __VA_ARGS__)

    template<typename ValueType, typename DeviceSpaceType>
    int CellTools_Test05(const bool verbose) {

      Teuchos::RCP<std::ostream> outStream;
      Teuchos::oblackholestream bhs; // outputs nothing

      if (verbose)
        outStream = Teuchos::rcp(&std::cout, false);
      else
        outStream = Teuchos::rcp(&bhs, false);

      Teuchos::oblackholestream oldFormatState;
      oldFormatState.copyfmt(std::cout);

      typedef typename
        Kokkos::Impl::is_space<DeviceSpaceType>::host_mirror_space::execution_space HostSpaceType ;

      *outStream << "DeviceSpace::  "; DeviceSpaceType::print_configuration(*outStream, false);
      *outStream << "HostSpace::    ";   HostSpaceType::print_configuration(*outStream, false);

      *outStream
        << "===============================================================================\n"
        << "|                                                                             |\n"
        << "|                              Unit Test CellTools                            |\n"
        << "|                                                                             |\n"
        << "|     1) Mapping to and from reference cells with base and extended topologies|\n"
        << "|        using default initial guesses when computing the inverse F^{-1}      |\n"
        << "|     2) Repeat all tests from 1) using user-defined initial guess for F^{-1} |\n"
        << "|     3) Exception testing                                                    |\n"
        << "|                                                                             |\n"
        << "|  Questions? Contact  Pavel Bochev (pbboche@sandia.gov)                      |\n"
        << "|                      Denis Ridzal (dridzal@sandia.gov), or                  |\n"
        << "|                      Kara Peterson (kjpeter@sandia.gov)                     |\n"
        << "|                                                                             |\n"
        << "|  Intrepid's website: http://trilinos.sandia.gov/packages/intrepid           |\n"
        << "|  Trilinos website:   http://trilinos.sandia.gov                             |\n"
        << "|                                                                             |\n"
        << "===============================================================================\n";

      int errorFlag  = 0;

      // Allocate storage and extract all standard cells with base topologies
      std::vector<shards::CellTopology> standardBaseTopologies;
      shards::getTopologies(standardBaseTopologies, 4, shards::STANDARD_CELL, shards::BASE_TOPOLOGY);

      *outStream
        << "\n"
        << "===============================================================================\n"
        << "| Test 3: Exception testing - only when HAVE_INTREPID2_DEBUG is defined.       |\n"
        << "===============================================================================\n\n";
      /*
       *  Test summary:
       *    Calls methods of CellTools class with incorrectly configured arguments. This test is run only
       *    in debug mode because many of the exceptions are checked only in that mode.
       *
       */


      try {
        
#ifdef HAVE_INTREPID2_DEBUG
        typedef Kokkos::DynRankView<ValueType,DeviceSpaceType> DynRankView;
        typedef CellTools<DeviceSpaceType> ct;

        std::vector<shards::CellTopology> standardBaseTopologies;
        shards::getTopologies(standardBaseTopologies, 4, shards::STANDARD_CELL, shards::BASE_TOPOLOGY);
        const ordinal_type topoSize = standardBaseTopologies.size();
        
        // Loop over admissible topologies
        for (ordinal_type topoOrd=0;topoOrd<topoSize;++topoOrd) {
          const auto cell = standardBaseTopologies[topoOrd];

          // skip cells not supported
          if (!ct::hasReferenceCell(cell))
            continue;

          *outStream << " Testing exceptions for "
                     <<  cell.getName() << "\n";

          // Initialize throw counter for exception testing
          ordinal_type nthrow = 0, ncatch = 0;

          // Some arbitrary dimensions
          ordinal_type C = 10, P = 21, N = cell.getNodeCount(), D = cell.getDimension();// V = cell.getVertexCount();

          // Array arguments
          DynRankView 
            jacobian, jacobianInv, jacobianDet, points, 
            worksetCell, physPoints, refPoints, initGuess,
            refSubcellPoints, paramPoints,
            refEdgeTangent, refFaceTanU, refFaceTanV,
            refSideNormal;

          // for 3D
          ordinal_type subcellDim = 2, subcellOrd = 0;

          /***********************************************************************************************
           *                          Exception tests for setJacobian method                            *
           **********************************************************************************************/
          
          // 1. incorrect jacobian rank
          jacobian = DynRankView("jacobian", C, P, D);
          points = DynRankView("points", P, D);
          worksetCell = DynRankView("worksetCell", C, N, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::setJacobian(jacobian, points, worksetCell, cell ) );
          
          // 2. Incorrect worksetCell rank
          worksetCell = DynRankView("worksetCell", C, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::setJacobian(jacobian, points, worksetCell, cell ) );
          
          // 3. Incorrect points rank
          worksetCell = DynRankView("worksetCell", C, N, D);
          points = DynRankView("points", D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::setJacobian(jacobian, points, worksetCell, cell ) );
          
          // 5. Non-matching dim
          jacobian = DynRankView("jacobian", C, P, D, D);
          points = DynRankView("points", C, P, D - 1);
          INTREPID2_TEST_ERROR_EXPECTED( ct::setJacobian(jacobian, points, worksetCell, cell ) );
            
          // 6. Non-matching dim
          jacobian = DynRankView("jacobian", C, P, D, D);
          points = DynRankView("points", C, P - 1, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::setJacobian(jacobian, points, worksetCell, cell ) );
          
          // 7. Non-matching dim
          jacobian = DynRankView("jacobian", C, P, D, D);
          points = DynRankView("points", C - 1, P, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::setJacobian(jacobian, points, worksetCell, cell ) );
          
          // 8. Non-matching dim
          jacobian = DynRankView("jacobian", C, P, D, D);
          points = DynRankView("points", C, P, D);
          worksetCell = DynRankView("worksetCell", C, N, D - 1);
          INTREPID2_TEST_ERROR_EXPECTED( ct::setJacobian(jacobian, points, worksetCell, cell ) );
          
          // 9. Non-matching dim
          jacobian = DynRankView("jacobian", C, P, D, D);
          points = DynRankView("points", C, P, D);
          worksetCell = DynRankView("worksetCell", C - 1, N, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::setJacobian(jacobian, points, worksetCell, cell ) );
          
          // 10. Incompatible ranks
          jacobian = DynRankView("jacobian", C, D, D);
          points = DynRankView("points", C, P, D);
          worksetCell = DynRankView("worksetCell", C, N, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::setJacobian(jacobian, points, worksetCell, cell ) );
          
          /***********************************************************************************************
           *                          Exception tests for setJacobianInv method                         *
           **********************************************************************************************/
          
          // 11. incompatible ranks
          jacobian = DynRankView("jacobian", C, P, D, D);
          jacobianInv = DynRankView("jacobianInv", P, D, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::setJacobianInv(jacobianInv, jacobian) );
          
          // 12. incorrect ranks
          jacobian = DynRankView("jacobian", D, D);
          jacobianInv = DynRankView("jacobianInv", D, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::setJacobianInv(jacobianInv, jacobian) );
          
          // 13. nonmatching dimensions
          jacobian = DynRankView("jacobian", C, P, D, D - 1);
          jacobianInv = DynRankView("jacobianInv", C, P, D, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::setJacobianInv(jacobianInv, jacobian) );
          
          // 14. nonmatching dimensions
          jacobian = DynRankView("jacobian", C, P, D - 1, D);
          jacobianInv = DynRankView("jacobianInv", C, P, D, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::setJacobianInv(jacobianInv, jacobian) );
          
          // 15. nonmatching dimensions
          jacobian = DynRankView("jacobian", C, P - 1, D, D);
          jacobianInv = DynRankView("jacobianInv", C, P, D, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::setJacobianInv(jacobianInv, jacobian) );

          // 16. nonmatching dimensions
          jacobian = DynRankView("jacobian", C - 1, P, D, D);
          jacobianInv = DynRankView("jacobianInv", C, P, D, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::setJacobianInv(jacobianInv, jacobian) );
          
          /***********************************************************************************************
           *                          Exception tests for setJacobianDet method                         *
           **********************************************************************************************/

          // 17. Incompatible ranks
          jacobian = DynRankView("jacobian", C, P, D, D);
          jacobianDet = DynRankView("jacobianDet", C, P, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::setJacobianDet(jacobianDet, jacobian) );

          // 18. Incompatible ranks
          jacobian = DynRankView("jacobian", P, D, D);
          jacobianDet = DynRankView("jacobianDet", C, P);
          INTREPID2_TEST_ERROR_EXPECTED( ct::setJacobianDet(jacobianDet, jacobian) );

          // 19. Incorrect rank
          jacobian = DynRankView("jacobian", D, D);
          jacobianDet = DynRankView("jacobianDet", C, P);
          INTREPID2_TEST_ERROR_EXPECTED( ct::setJacobianDet(jacobianDet, jacobian) );

          // 20. Incorrect rank
          jacobian = DynRankView("jacobian", C, P, D, D);
          jacobianDet = DynRankView("jacobianDet", C);
          INTREPID2_TEST_ERROR_EXPECTED( ct::setJacobianDet(jacobianDet, jacobian) );

          // 21. Incorrect dimension
          jacobian = DynRankView("jacobian", C, P, D, D);
          jacobianDet = DynRankView("jacobianDet", C, P-1);
          INTREPID2_TEST_ERROR_EXPECTED( ct::setJacobianDet(jacobianDet, jacobian) );

          // 22. Incorrect dimension
          jacobian = DynRankView("jacobian", C - 1, P, D, D);
          jacobianDet = DynRankView("jacobianDet", C, P);
          INTREPID2_TEST_ERROR_EXPECTED( ct::setJacobianDet(jacobianDet, jacobian) );

          /***********************************************************************************************
           *                        Exception tests for mapToPhysicalFrame method                       *
           **********************************************************************************************/

          // 23. Incorrect refPoint rank
          refPoints = DynRankView("refPoints", P);
          physPoints = DynRankView("physPoints", P, D);
          worksetCell = DynRankView("worksetCell", C, N, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::mapToPhysicalFrame(physPoints, refPoints, worksetCell, cell ) );

          // 24. Incorrect workset rank
          worksetCell = DynRankView("worksetCell", P, D);
          refPoints = DynRankView("refPoints", P, D);
          physPoints = DynRankView("physPoints", C, P, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::mapToPhysicalFrame(physPoints, refPoints, worksetCell, cell ) );
          
          // 25. Incompatible ranks
          refPoints = DynRankView("refPoints", C, P, D);
          physPoints = DynRankView("physPoints", P, D);
          worksetCell = DynRankView("worksetCell", C, N, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::mapToPhysicalFrame(physPoints, refPoints, worksetCell, cell ) );
          
          // 26. Incompatible dimensions
          refPoints = DynRankView("refPoints", C, P, D);
          physPoints = DynRankView("physPoints", C, P, D - 1);
          INTREPID2_TEST_ERROR_EXPECTED( ct::mapToPhysicalFrame(physPoints, refPoints, worksetCell, cell ) );
          
          // 27. Incompatible dimensions
          refPoints = DynRankView("refPoints", C, P, D);
          physPoints = DynRankView("physPoints", C, P - 1, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::mapToPhysicalFrame(physPoints, refPoints, worksetCell, cell ) );
          
          // 28. Incompatible dimensions
          refPoints = DynRankView("refPoints", C, P, D);
          physPoints = DynRankView("physPoints", C - 1, P, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::mapToPhysicalFrame(physPoints, refPoints, worksetCell, cell ) );
          
          /***********************************************************************************************
           *          Exception tests for mapToReferenceFrame method (with default initial guesses)     *
           **********************************************************************************************/
          
          // 30. incompatible ranks
          refPoints = DynRankView("refPoints", C, P, D);
          physPoints = DynRankView("physPoints", P, D);
          worksetCell = DynRankView("worksetCell", C, N, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::mapToReferenceFrame(refPoints, physPoints, worksetCell, cell ) );
          
          // 32. Incompatible ranks with whichCell = -1 (default)
          refPoints = DynRankView("refPoints", P, D);
          physPoints = DynRankView("physPoints", P, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::mapToReferenceFrame(refPoints, physPoints, worksetCell, cell ) );

          // 33. Nonmatching dimensions
          refPoints = DynRankView("refPoints", C, P, D - 1);
          physPoints = DynRankView("physPoints", C, P, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::mapToReferenceFrame(refPoints, physPoints, worksetCell, cell ) );

          // 34. Nonmatching dimensions
          refPoints = DynRankView("refPoints", C, P - 1, D);
          physPoints = DynRankView("physPoints", C, P, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::mapToReferenceFrame(refPoints, physPoints, worksetCell, cell ) );

          // 35. Nonmatching dimensions
          refPoints = DynRankView("refPoints", C - 1, P, D);
          physPoints = DynRankView("physPoints", C, P, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::mapToReferenceFrame(refPoints, physPoints, worksetCell, cell ) );

          // 36. Incorrect rank for worksetCell
          refPoints = DynRankView("refPoints", C, P, D);
          physPoints = DynRankView("physPoints", C, P, D);
          worksetCell = DynRankView("worksetCell", C, N);
          INTREPID2_TEST_ERROR_EXPECTED( ct::mapToReferenceFrame(refPoints, physPoints, worksetCell, cell ) );
          
          /***********************************************************************************************
           *   Exception tests for mapToReferenceFrameInitGuess method (initial guess is a parameter)   *
           **********************************************************************************************/
          
          // 37. Incompatible ranks
          refPoints = DynRankView("refPoints", C, P, D);
          physPoints = DynRankView("physPoints", C, P, D);
          initGuess = DynRankView("initGuess", P, D);
          worksetCell = DynRankView("worksetCell", C, N, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::mapToReferenceFrameInitGuess(refPoints, initGuess, physPoints, worksetCell, cell ) );

          // 39. Nonmatching dimensions
          refPoints = DynRankView("refPoints", C, P, D);
          physPoints = DynRankView("physPoints", C, P, D);
          initGuess = DynRankView("initGuess", C, P, D - 1);
          INTREPID2_TEST_ERROR_EXPECTED( ct::mapToReferenceFrameInitGuess(refPoints, initGuess, physPoints, worksetCell, cell ) );

          // 40. Nonmatching dimensions
          initGuess = DynRankView("initGuess", C, P - 1, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::mapToReferenceFrameInitGuess(refPoints, initGuess, physPoints, worksetCell, cell ) );

          // 41. Nonmatching dimensions
          initGuess = DynRankView("initGuess", C - 1, P, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::mapToReferenceFrameInitGuess(refPoints, initGuess, physPoints, worksetCell, cell ) );
          
          /***********************************************************************************************
           *                        Exception tests for mapToReferenceSubcell method                    *
           **********************************************************************************************/

          // 42. Incorrect array rank
          refSubcellPoints = DynRankView("refSubcellPoints", P,3);
          paramPoints = DynRankView("paramPoints", P);
          INTREPID2_TEST_ERROR_EXPECTED( ct::mapToReferenceSubcell(refSubcellPoints, paramPoints, subcellDim, subcellOrd, cell ) );

          // 43. Incorrect array rank
          refSubcellPoints = DynRankView("refSubcellPoints", P);
          paramPoints = DynRankView("paramPoints", P, 2);
          INTREPID2_TEST_ERROR_EXPECTED( ct::mapToReferenceSubcell(refSubcellPoints, paramPoints, subcellDim, subcellOrd, cell ) );

          // 44. Incorrect array dimension for face of 3D cell (should be 3)
          refSubcellPoints = DynRankView("refSubcellPoints", P, 2);
          paramPoints = DynRankView("paramPoints", P, 2);
          INTREPID2_TEST_ERROR_EXPECTED( ct::mapToReferenceSubcell(refSubcellPoints, paramPoints, subcellDim, subcellOrd, cell ) );
          
          // 45. Incorrect array dimension for parametrization domain of a face of 3D cell (should be 2)
          refSubcellPoints = DynRankView("refSubcellPoints", P, 3);
          paramPoints = DynRankView("paramPoints", P, 3);
          INTREPID2_TEST_ERROR_EXPECTED( ct::mapToReferenceSubcell(refSubcellPoints, paramPoints, subcellDim, subcellOrd, cell ) );

          /***********************************************************************************************
           *                        Exception tests for getReferenceEdgeTangent method                  *
           **********************************************************************************************/

          // 46. Incorrect rank
          refEdgeTangent = DynRankView("refEdgeTangent", C,P,D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::getReferenceEdgeTangent(refEdgeTangent, 0, cell ) );

          // 47. Incorrect dimension D for Tet<10> cell
          refEdgeTangent = DynRankView("refEdgeTangent", 2);
          INTREPID2_TEST_ERROR_EXPECTED( ct::getReferenceEdgeTangent(refEdgeTangent, 0, cell ) );

          // 48. Invalid edge ordinal for Tet<10>
          refEdgeTangent = DynRankView("refEdgeTangent", C,P,D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::getReferenceEdgeTangent(refEdgeTangent, 10, cell ) );

          /***********************************************************************************************
           *                        Exception tests for getReferenceFaceTangents method                 *
           **********************************************************************************************/

          // 49. Incorrect rank
          refFaceTanU = DynRankView("refFaceTanU", P, D);
          refFaceTanV = DynRankView("refFaceTanV", D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::getReferenceFaceTangents(refFaceTanU, refFaceTanV, 0, cell ) );

          // 50. Incorrect rank
          refFaceTanU = DynRankView("refFaceTanU", D);
          refFaceTanV = DynRankView("refFaceTanV", P, D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::getReferenceFaceTangents(refFaceTanU, refFaceTanV, 0, cell ) );

          // 51. Incorrect dimension for 3D cell
          refFaceTanU = DynRankView("refFaceTanU", D - 1);
          refFaceTanV = DynRankView("refFaceTanV", D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::getReferenceFaceTangents(refFaceTanU, refFaceTanV, 0, cell ) );

          // 52. Incorrect dimension for 3D cell
          refFaceTanU = DynRankView("refFaceTanU", D);
          refFaceTanV = DynRankView("refFaceTanV", D - 1);
          INTREPID2_TEST_ERROR_EXPECTED( ct::getReferenceFaceTangents(refFaceTanU, refFaceTanV, 0, cell ) );

          // 53. Invalid face ordinal
          refFaceTanU = DynRankView("refFaceTanU", D);
          refFaceTanV = DynRankView("refFaceTanV", D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::getReferenceFaceTangents(refFaceTanU, refFaceTanV, 10, cell ) );

          /***********************************************************************************************
           *                        Exception tests for getReferenceSide/FaceNormal methods             *
           **********************************************************************************************/

          // 54-55. Incorrect rank
          refSideNormal = DynRankView("refSideNormal", C,P);
          INTREPID2_TEST_ERROR_EXPECTED( ct::getReferenceSideNormal(refSideNormal, 0, cell ) );

          // 56-57. Incorrect dimension for 3D cell
          refSideNormal = DynRankView("refSideNormal", D - 1);
          INTREPID2_TEST_ERROR_EXPECTED( ct::getReferenceSideNormal(refSideNormal, 0, cell ) );

          // 58-59. Invalid side ordinal for Tet<10>
          refSideNormal = DynRankView("refSideNormal", D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::getReferenceSideNormal(refSideNormal, 10, cell ) );

          // 60. Incorrect dimension for 2D cell
          refSideNormal = DynRankView("refSideNormal", D - 1);
          INTREPID2_TEST_ERROR_EXPECTED( ct::getReferenceSideNormal(refSideNormal, 0, cell ) );

          // 61. Invalid side ordinal for Tri<3>
          refSideNormal = DynRankView("refSideNormal", D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::getReferenceSideNormal(refSideNormal, 10, cell ) );

          // 62. Cannot call the "face" method for 2D cells
          refSideNormal = DynRankView("refSideNormal", D);
          INTREPID2_TEST_ERROR_EXPECTED( ct::getReferenceFaceNormal(refSideNormal, 0, cell ) );

          /***********************************************************************************************
           *          Exception tests for checkPoint/Pointset/PointwiseInclusion methods        *
           **********************************************************************************************/
          // points.resize(2,3,3,4);
          // FieldContainer<int> inCell;

          // 63. Point dimension does not match cell topology
          points = DynRankView("points", D+1);
          INTREPID2_TEST_ERROR_EXPECTED( ct::checkPointInclusion(points, cell ) );

          // // 64. Invalid cell topology
          // CellTopology pentagon_5(shards::getCellTopologyData<shards::Pentagon<> >() );
          // INTREPID2_TEST_ERROR_EXPECTED(ct::checkPointInclusion(point, pentagon_5.getDimension(), pentagon_5 ),
          //                               throwCounter, nException );

          // // 65. Incorrect spatial dimension of points
          // points.resize(10, 10, cell.getDimension() + 1);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::checkPointsetInclusion(points, cell ),
          //                               throwCounter, nException );

          // // 66. Incorrect rank of input array
          // points.resize(10,10,10,3);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::checkPointsetInclusion(points, cell ),
          //                               throwCounter, nException );

          // // 67. Incorrect rank of output array
          // points.resize(10,10,cell.getDimension() );
          // inCell.resize(10);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::checkPointwiseInclusion(inCell, points, cell ),
          //                               throwCounter, nException );

          // // 68. Incorrect rank of output array
          // points.resize(10, cell.getDimension() );
          // inCell.resize(10, 10);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::checkPointwiseInclusion(inCell, points, cell ),
          //                               throwCounter, nException );

          // // 69. Incorrect rank of output array
          // points.resize(cell.getDimension() );
          // inCell.resize(10, 10);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::checkPointwiseInclusion(inCell, points, cell ),
          //                               throwCounter, nException );

          // // 70. Incorrect dimension of output array
          // points.resize(10, 10, cell.getDimension() );
          // inCell.resize(10, 9);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::checkPointwiseInclusion(inCell, points, cell ),
          //                               throwCounter, nException );

          // // 71. Incorrect dimension of output array
          // points.resize(10, 10, cell.getDimension() );
          // inCell.resize(9, 10);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::checkPointwiseInclusion(inCell, points, cell ),
          //                               throwCounter, nException );

          // // 72. Incorrect dimension of output array
          // points.resize(10, cell.getDimension() );
          // inCell.resize(9);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::checkPointwiseInclusion(inCell, points, cell ),
          //                               throwCounter, nException );

          // // 73. Incorrect spatial dimension of input array
          // points.resize(10, 10, cell.getDimension() + 1);
          // inCell.resize(10, 10);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::checkPointwiseInclusion(inCell, points, cell ),
          //                               throwCounter, nException );

          // // 74. Incorrect rank of input array.
          // points.resize(10,10,10,3);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::checkPointwiseInclusion(inCell, points, cell ),
          //                               throwCounter, nException );


          // physPoints = DynRankView("physPoints", C, P, D);
          // inCell.resize(C, P);
          // // 75. Invalid rank of worksetCell
          // worksetCell = DynRankView("worksetCell", C, N, D, D);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::checkPointwiseInclusion(inCell, physPoints, worksetCell, cell ),
          //                               throwCounter, nException );

          // // 76. Invalid dimension 1 (node count) of worksetCell
          // worksetCell = DynRankView("worksetCell", C, N + 1, D);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::checkPointwiseInclusion(inCell, physPoints, worksetCell, cell ),
          //                               throwCounter, nException );

          // // 77. Invalid dimension 2 (spatial dimension) of worksetCell
          // worksetCell = DynRankView("worksetCell", C, N, D + 1);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::checkPointwiseInclusion(inCell, physPoints, worksetCell, cell ),
          //                               throwCounter, nException );

          // // 78. Invalid whichCell value (exceeds cell count in the workset)
          // worksetCell = DynRankView("worksetCell", C, N, D);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::checkPointwiseInclusion(inCell, physPoints, worksetCell, cell, C + 1 ),
          //                               throwCounter, nException );

          // // 79. Invalid whichCell for rank-3 physPoints (must be -1, here it is valid cell ordinal)
          // INTREPID2_TEST_ERROR_EXPECTED(ct::checkPointwiseInclusion(inCell, physPoints, worksetCell, cell, 0 ),
          //                               throwCounter, nException );

          // // 80. Invalid whichCell for rank-2 physPoints (must be a valid cell ordinal, here it is the default -1)
          // physPoints = DynRankView("physPoints", P, D);
          // inCell.resize(P);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::checkPointwiseInclusion(inCell, physPoints, worksetCell, cell ),
          //                               throwCounter, nException );

          // // 81. Incompatible ranks of I/O arrays
          // physPoints = DynRankView("physPoints", C, P, D);
          // inCell.resize(P);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::checkPointwiseInclusion(inCell, physPoints, worksetCell, cell ) );
          //                               throwCounter, nException );

          // // 82. Incompatible ranks of I/O arrays
          // physPoints = DynRankView("physPoints", P, D);
          // inCell.resize(C, P);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::checkPointwiseInclusion(inCell, physPoints, worksetCell, cell, 0),
          //                               throwCounter, nException );

          // // 83. Incompatible dimensions of I/O arrays
          // physPoints = DynRankView("physPoints", C, P, D);
          // inCell.resize(C, P + 1);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::checkPointwiseInclusion(inCell, physPoints, worksetCell, cell ) );
          //                               throwCounter, nException );

          // // 84. Incompatible dimensions of I/O arrays: rank-3 Input
          // physPoints = DynRankView("physPoints", C + 1, P, D);
          // inCell.resize(C, P);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::checkPointwiseInclusion(inCell, physPoints, worksetCell, cell ) );
          //                               throwCounter, nException );

          // // 85. Incompatible dimensions of I/O arrays: rank-2 Input
          // physPoints = DynRankView("physPoints", P, D);
          // inCell.resize(P + 1);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::checkPointwiseInclusion(inCell, physPoints, worksetCell, cell, 0 ),
          //                               throwCounter, nException );


          // /***********************************************************************************************
          //  *               Exception tests for getReferenceVertex/vertices/Node/Nodes methods           *
          //  **********************************************************************************************/

          // FieldContainer<double> subcellNodes;

          // // 86-89. Cell does not have reference cell
          // INTREPID2_TEST_ERROR_EXPECTED(ct::getReferenceVertex(pentagon_5, 0), throwCounter, nException);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::getReferenceNode(pentagon_5, 0), throwCounter, nException);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::getReferenceSubcellVertices(subcellNodes, 0, 0, pentagon_5), throwCounter, nException);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::getReferenceSubcellNodes(subcellNodes, 0, 0, pentagon_5), throwCounter, nException);

          // // Use last cell topology (Wedge<18>) for these tests
          // topo_iterator = supportedTopologies.end() - 1;
          // D = cell.getDimension();
          // int subcDim = D - 1;
          // int S = cell.getSubcellCount(subcDim);
          // V = cell.getVertexCount(subcDim, S - 1);
          // subcellNodes.resize(V, D);
          // // 90. subcell ordinal out of range
          // INTREPID2_TEST_ERROR_EXPECTED(ct::getReferenceSubcellVertices(subcellNodes, subcDim, S + 1, cell ) );
          //                               throwCounter, nException);

          // // 91. subcell dim out of range
          // INTREPID2_TEST_ERROR_EXPECTED(ct::getReferenceSubcellVertices(subcellNodes, D + 1, S, cell ) );
          //                               throwCounter, nException);

          // // 92. Incorrect rank for subcellNodes
          // subcellNodes.resize(V, D, D);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::getReferenceSubcellVertices(subcellNodes, subcDim, S - 1, cell ) );
          //                               throwCounter, nException);

          // // 93. Incorrect dimension for subcellNodes
          // subcellNodes.resize(V - 1, D);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::getReferenceSubcellVertices(subcellNodes, subcDim, S - 1, cell ) );
          //                               throwCounter, nException);

          // // 94. Incorrect dimension for subcellNodes
          // subcellNodes.resize(V, D - 1);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::getReferenceSubcellVertices(subcellNodes, subcDim, S - 1, cell ) );
          //                               throwCounter, nException);


          // N = cell.getNodeCount(subcDim, S - 1);
          // subcellNodes.resize(N, D);
          // // 95. subcell ordinal out of range
          // INTREPID2_TEST_ERROR_EXPECTED(ct::getReferenceSubcellNodes(subcellNodes, subcDim, S + 1, cell ) );
          //                               throwCounter, nException);

          // // 96. subcell dim out of range
          // INTREPID2_TEST_ERROR_EXPECTED(ct::getReferenceSubcellNodes(subcellNodes, D + 1, S, cell ) );
          //                               throwCounter, nException);

          // // 97. Incorrect rank for subcellNodes
          // subcellNodes.resize(N, D, D);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::getReferenceSubcellNodes(subcellNodes, subcDim, S - 1, cell ) );
          //                               throwCounter, nException);

          // // 98. Incorrect dimension for subcellNodes
          // subcellNodes.resize(N - 1, D);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::getReferenceSubcellNodes(subcellNodes, subcDim, S - 1, cell ) );
          //                               throwCounter, nException);

          // // 99. Incorrect dimension for subcellNodes
          // subcellNodes.resize(N, D - 1);
          // INTREPID2_TEST_ERROR_EXPECTED(ct::getReferenceSubcellNodes(subcellNodes, subcDim, S - 1, cell ) );
          //                               throwCounter, nException);

          // something wrong in counting
          // if (nthrow != ncatch) {
          //   errorFlag++;
          //   *outStream << " nthrow = " << nthrow << "  ncatch = " << ncatch << std::endl;
          //   *outStream << std::setw(70) << "^^^^----FAILURE!" << "\n";
          // }
        }
#endif
      } catch(std::exception err) {
        *outStream << "Unexpected Error = " << err.what() << "\n";
        errorFlag = -1000;
      }
      
      if (errorFlag != 0)
        std::cout << "End Result: TEST FAILED\n";
      else
        std::cout << "End Result: TEST PASSED\n";
      
      //reset format state of std::cout
      std::cout.copyfmt(oldFormatState);
      
      return errorFlag;
    }
  }
}