Intrepid2
Intrepid2_CellToolsDefValidateArguments.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ************************************************************************
3 //
4 // Intrepid2 Package
5 // Copyright (2007) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Kyungjoo Kim (kyukim@sandia.gov), or
38 // Mauro Perego (mperego@sandia.gov)
39 //
40 // ************************************************************************
41 // @HEADER
42 
43 
49 #ifndef __INTREPID2_CELLTOOLS_DEF_VALIDATE_ARGUMENTS_HPP__
50 #define __INTREPID2_CELLTOOLS_DEF_VALIDATE_ARGUMENTS_HPP__
51 
52 // disable clang warnings
53 #if defined (__clang__) && !defined (__INTEL_COMPILER)
54 #pragma clang system_header
55 #endif
56 
57 namespace Intrepid2 {
58 
59  //============================================================================================//
60  // //
61  // Validation of input/output arguments for CellTools methods //
62  // //
63  //============================================================================================//
64 
65  template<typename jacobianViewType,
66  typename pointViewType,
67  typename worksetCellViewType>
68  void
69  CellTools_setJacobianArgs( const jacobianViewType jacobian,
70  const pointViewType points,
71  const worksetCellViewType worksetCell,
72  const shards::CellTopology cellTopo ) {
73  // Validate worksetCell array
74  INTREPID2_TEST_FOR_EXCEPTION( worksetCell.rank() != 3, std::invalid_argument,
75  ">>> ERROR (Intrepid2::CellTools::setJacobian): rank = 3 required for worksetCell array." );
76  //TODO: check this. not working for composite tet
77  //INTREPID2_TEST_FOR_EXCEPTION( worksetCell.extent(1) != cellTopo.getSubcellCount(0), std::invalid_argument,
78  // ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 1 (number of cell nodes) of worksetCell array does not match cell topology." );
79 
80  INTREPID2_TEST_FOR_EXCEPTION( worksetCell.extent(2) != cellTopo.getDimension(), std::invalid_argument,
81  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 2 (spatial dimension) of worksetCell array does not match cell dimension." );
82 
83  // Validate points array: can be rank-2 (P,D) or rank-3 (C,P,D)
84  // If rank-2: admissible jacobians: rank-3 (P,D,D) or rank-4 (C,P,D,D); admissible whichCell: -1 (default) or cell ordinal.
85  const auto pointRank = points.rank();
86  INTREPID2_TEST_FOR_EXCEPTION( pointRank != 2 &&
87  pointRank != 3, std::invalid_argument,
88  ">>> ERROR (Intrepid2::CellTools::setJacobian): points must have rank 2 or 3." );
89 
90  switch (pointRank) {
91  case 2: {
92  INTREPID2_TEST_FOR_EXCEPTION( points.extent(1) != cellTopo.getDimension(), std::invalid_argument,
93  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 1 (spatial dimension) of points array does not match cell dimension." );
94 
95  INTREPID2_TEST_FOR_EXCEPTION( jacobian.rank() != 4, std::invalid_argument,
96  ">>> ERROR (Intrepid2::CellTools::setJacobian): rank = 4 required for jacobian array." );
97 
98  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(0) != worksetCell.extent(0), std::invalid_argument,
99  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 0 (number of cells) of jacobian array must equal dim 0 of worksetCell array." );
100 
101  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(1) != points.extent(0), std::invalid_argument,
102  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 1 (number of points) of jacobian array must equal dim 0 of points array." );
103 
104  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(2) != points.extent(1), std::invalid_argument,
105  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 2 (spatial dimension) of jacobian array must equal dim 1 of points array." );
106 
107  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(2) != jacobian.extent(3), std::invalid_argument,
108  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 2 = dim 3 (same spatial dimensions) required for jacobian array." );
109 
110  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(3) < 1 || jacobian.extent(3) > 3, std::invalid_argument,
111  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 2 and dim 3 (spatial dimensions) must be between 1 and 3." );
112  break;
113  }
114  case 3: {
115  INTREPID2_TEST_FOR_EXCEPTION( points.extent(0) != worksetCell.extent(0), std::invalid_argument,
116  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 0 (number of cells) of points array must equal dim 0 of cellWorkset array");
117 
118  INTREPID2_TEST_FOR_EXCEPTION( points.extent(2) != cellTopo.getDimension(), std::invalid_argument,
119  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 2 (spatial dimension) of points array does not match cell dimension");
120 
121  // rank-4 (C,P,D,D) jacobian required for rank-3 (C,P,D) input points
122  INTREPID2_TEST_FOR_EXCEPTION( jacobian.rank() != 4, std::invalid_argument,
123  ">>> ERROR (Intrepid2::CellTools::setJacobian): rank = 4 required for jacobian array." );
124 
125  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(0) != points.extent(0), std::invalid_argument,
126  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 0 (number of cells) of jacobian array must equal dim 0 of points array");
127 
128  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(1) != points.extent(1), std::invalid_argument,
129  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 1 (number of points) of jacobian array must equal dim 1 of points array");
130 
131  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(2) != points.extent(2), std::invalid_argument,
132  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 2 (spatial dimension) of jacobian array must equal dim 2 of points array");
133 
134  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(2) != jacobian.extent(3), std::invalid_argument,
135  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 2 = dim 3 (same spatial dimensions) required for jacobian array. ");
136 
137  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(3) < 1 || jacobian.extent(3) > 3, std::invalid_argument,
138  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 2 and dim 3 (spatial dimensions) must be between 1 and 3." );
139  break;
140  }
141  }
142  }
143 
144  template<typename jacobianInvViewType,
145  typename jacobianViewType>
146  void
147  CellTools_setJacobianInvArgs( const jacobianInvViewType jacobianInv,
148  const jacobianViewType jacobian ) {
149  // Validate input jacobian array: admissible ranks & dimensions are:
150  // - rank-4 with dimensions (C,P,D,D), or rank-3 with dimensions (P,D,D).
151  const ordinal_type jacoRank = jacobian.rank();
152  INTREPID2_TEST_FOR_EXCEPTION( jacoRank != 4 &&
153  jacoRank != 3, std::invalid_argument,
154  ">>> ERROR (Intrepid2::CellTools::setJacobianInv): rank = 4 or 3 required for jacobian array." );
155 
156  // Verify correctness of spatial dimensions - they are the last two dimensions of the array: rank-2 and rank-1
157  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(jacoRank - 1) != jacobian.extent(jacoRank - 2), std::invalid_argument,
158  ">>> ERROR (Intrepid2::CellTools::setJacobianInv): dim(rank-2) = dim(rank-2) (same spatial dimensions) required for jacobian array." );
159 
160  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(jacoRank - 1) < 1 ||
161  jacobian.extent(jacoRank - 1) > 3, std::invalid_argument,
162  ">>> ERROR (Intrepid2::CellTools::setJacobianInv): dim(rank-1) and dim(rank-2) (spatial dimensions) must be between 1 and 3." );
163 
164  // Validate output jacobianInv array: must have the same rank and dimensions as the input array.
165  const ordinal_type jacoInvRank = jacobianInv.rank();
166  INTREPID2_TEST_FOR_EXCEPTION( jacoInvRank != jacoRank, std::invalid_argument,
167  ">>> ERROR (Intrepid2::CellTools::setJacobianInv): jacobian rank does not match to jacobianInv." );
168 
169  for (ordinal_type i=0;i<jacoRank;++i) {
170  INTREPID2_TEST_FOR_EXCEPTION( jacobianInv.extent(i) != jacobian.extent(i), std::invalid_argument,
171  ">>> ERROR (Intrepid2::CellTools::setJacobianInv): jacobian dimension (i) does not match to jacobianInv dimension (i)." );
172  }
173  }
174 
175 
176  template<typename jacobianDetViewType,
177  typename jacobianViewType>
178  void
179  CellTools_setJacobianDetArgs( const jacobianDetViewType jacobianDet,
180  const jacobianViewType jacobian ) {
181  // Validate input jacobian array: admissible ranks & dimensions are:
182  // - rank-4 with dimensions (C,P,D,D), or rank-3 with dimensions (P,D,D).
183  const ordinal_type jacoRank = jacobian.rank();
184  INTREPID2_TEST_FOR_EXCEPTION( jacoRank != 4 &&
185  jacoRank != 3, std::invalid_argument,
186  ">>> ERROR (Intrepid2::CellTools::setJacobianInv): rank = 4 or 3 required for jacobian array." );
187 
188  // Verify correctness of spatial dimensions - they are the last two dimensions of the array: rank-2 and rank-1
189  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(jacoRank - 1) != jacobian.extent(jacoRank - 2), std::invalid_argument,
190  ">>> ERROR (Intrepid2::CellTools::setJacobianInv): dim(rank-2) = dim(rank-2) (same spatial dimensions) required for jacobian array." );
191 
192  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(jacoRank - 1) < 1 ||
193  jacobian.extent(jacoRank - 1) > 3, std::invalid_argument,
194  ">>> ERROR (Intrepid2::CellTools::setJacobianInv): dim(rank-1) and dim(rank-2) (spatial dimensions) must be between 1 and 3." );
195 
196  // Validate output jacobianDet array
197  const ordinal_type jacoDetRank = jacobianDet.rank();
198  // must be rank-2 with dimensions (C,P) if jacobian was rank-4
199  // must be rank-1 with dimension (P) if jacobian was rank-3
200  INTREPID2_TEST_FOR_EXCEPTION( jacoDetRank != (jacoRank-2), std::invalid_argument,
201  ">>> ERROR (Intrepid2::CellTools::setJacobianDetArgs): rank = 2 required for jacobianDet if jacobian is rank-4." );
202 
203  for (ordinal_type i=0;i<jacoDetRank;++i) {
204  INTREPID2_TEST_FOR_EXCEPTION( jacobianDet.extent(i) != jacobian.extent(i), std::invalid_argument,
205  ">>> ERROR (Intrepid2::CellTools::setJacobianDetArgs): jacobianDet dimension (i) does not match to jacobian dimension (i)." );
206  }
207  }
208 
209 
210 
211  template<typename physPointViewType,
212  typename refPointViewType,
213  typename worksetCellViewType>
214  void
215  CellTools_mapToPhysicalFrameArgs( const physPointViewType physPoints,
216  const refPointViewType refPoints,
217  const worksetCellViewType worksetCell,
218  const shards::CellTopology cellTopo ) {
219  // Validate worksetCell array
220  INTREPID2_TEST_FOR_EXCEPTION( worksetCell.rank() != 3, std::invalid_argument,
221  ">>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): rank = 3 required for worksetCell array." );
222 
223  //TODO: check this, not working for tria6
224  //INTREPID2_TEST_FOR_EXCEPTION( worksetCell.extent(1) != cellTopo.getSubcellCount(0), std::invalid_argument,
225  // ">>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): dim 1 (number of cell nodes) of worksetCell array does not match cell topology." );
226 
227  INTREPID2_TEST_FOR_EXCEPTION( worksetCell.extent(2) != cellTopo.getDimension(), std::invalid_argument,
228  ">>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): dim 2 (spatial dimension) of worksetCell array does not match cell dimension." );
229 
230 
231  // Validate refPoints array: can be rank-2 (P,D) or rank-3 (C,P,D) array
232  const ordinal_type refPointRank = refPoints.rank();
233  const ordinal_type physPointRank = physPoints.rank();
234 
235  INTREPID2_TEST_FOR_EXCEPTION( refPointRank != 2 &&
236  refPointRank != 3, std::invalid_argument,
237  ">>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): refPoints requires rank 2 or 3." );
238 
239  switch (refPointRank) {
240  case 2: {
241  // If rank-2: admissible output array is (P,D) or (C,P,D)
242  INTREPID2_TEST_FOR_EXCEPTION( refPoints.extent(1) != cellTopo.getDimension(), std::invalid_argument,
243  ">>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): dim 1 (spatial dimension) of refPoints array does not match cell dimension." );
244 
245  INTREPID2_TEST_FOR_EXCEPTION( physPoints.rank() != 3, std::invalid_argument,
246  ">>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): rank = 3 required for physPoints array for the default whichCell value." );
247 
248  INTREPID2_TEST_FOR_EXCEPTION( physPoints.extent(0) != worksetCell.extent(0), std::invalid_argument,
249  ">>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): dim 0 (number of cells) of physPoints array must equal dim 0 of worksetCell array." );
250 
251  INTREPID2_TEST_FOR_EXCEPTION( physPoints.extent(1) != refPoints.extent(0), std::invalid_argument,
252  ">>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): dim 1 (number of points) of physPoints array must equal dim 0 of refPoints array." );
253 
254  INTREPID2_TEST_FOR_EXCEPTION( physPoints.extent(2) != cellTopo.getDimension(), std::invalid_argument,
255  ">>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): dim 2 (spatial dimension) does not match cell dimension." );
256  break;
257  }
258  case 3: {
259  // refPoints is (C,P,D): requires physPoints to be (C,P,D) and whichCell=-1 (because all cell mappings are applied)
260  // validate refPoints dimensions and rank
261  INTREPID2_TEST_FOR_EXCEPTION( refPoints.extent(0) != worksetCell.extent(0), std::invalid_argument,
262  ">>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): dim 0 (number of cells) of refPoints and worksetCell arraya are required to match." );
263 
264  INTREPID2_TEST_FOR_EXCEPTION( refPoints.extent(2) != cellTopo.getDimension(), std::invalid_argument,
265  ">>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): dim 2 (spatial dimension) of refPoints array does not match cell dimension." );
266 
267  // physPoints must match rank and dimensions of refPoints
268  INTREPID2_TEST_FOR_EXCEPTION( refPointRank != physPointRank, std::invalid_argument,
269  " >>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): refPoints rank does not match to physPoints rank." );
270 
271  for (ordinal_type i=0;i<refPointRank;++i) {
272  INTREPID2_TEST_FOR_EXCEPTION( refPoints.extent(i) != physPoints.extent(i), std::invalid_argument,
273  " >>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): refPoints dimension(i) does not match to physPoints dimension(i)." );
274  }
275  break;
276  }
277  }
278  }
279 
280  template<typename refPointViewType,
281  typename physPointViewType,
282  typename worksetCellViewType>
283  void
284  CellTools_mapToReferenceFrameArgs( const refPointViewType refPoints,
285  const physPointViewType physPoints,
286  const worksetCellViewType worksetCell,
287  const shards::CellTopology cellTopo ) {
288  // Validate worksetCell array
289  const ordinal_type worksetCellRank = worksetCell.rank();
290  INTREPID2_TEST_FOR_EXCEPTION( worksetCellRank != 3, std::invalid_argument,
291  ">>> ERROR (Intrepid2::CellTools::mapToReferenceFrame): rank = 3 required for worksetCell array" );
292  // TODO: check this.
293  // INTREPID2_TEST_FOR_EXCEPTION( worksetCell.extent(1) != cellTopo.getSubcellCount(0), std::invalid_argument,
294  // ">>> ERROR (Intrepid2::CellTools::mapToReferenceFrame): dim 1 (number of cell nodes) of worksetCell array does not match cell topology" );
295 
296  INTREPID2_TEST_FOR_EXCEPTION( worksetCell.extent(2) != cellTopo.getDimension(), std::invalid_argument,
297  ">>> ERROR (Intrepid2::CellTools::mapToReferenceFrame): dim 2 (spatial dimension) of worksetCell array does not match cell dimension" );
298 
299  // Admissible ranks and dimensions of refPoints and physPoints depend on whichCell value:
300  // default is to map multiple sets of points to multiple sets of points. (C,P,D) arrays required
301 
302  const ordinal_type physPointRank = physPoints.rank();
303  const ordinal_type refPointRank = refPoints.rank();
304 
305  INTREPID2_TEST_FOR_EXCEPTION( refPointRank != 2 &&
306  refPointRank != 3, std::invalid_argument,
307  ">>> ERROR (Intrepid2::CellTools::mapToReferenceFrame): refPoint must have rank 2 or 3." );
308 
309  INTREPID2_TEST_FOR_EXCEPTION( physPointRank != refPointRank, std::invalid_argument,
310  ">>> ERROR (Intrepid2::CellTools::mapToReferenceFrame): physPoints rank does not match refPoints rank." );
311  for (ordinal_type i=0;i<refPointRank;++i) {
312  INTREPID2_TEST_FOR_EXCEPTION( refPoints.extent(i) != physPoints.extent(i), std::invalid_argument,
313  ">>> ERROR (Intrepid2::CellTools::mapToReferenceFrame): physPoints dimension (i) does not match refPoints dimension (i)." );
314  }
315  }
316 
317  template<typename refPointViewType,
318  typename initGuessViewType,
319  typename physPointViewType,
320  typename worksetCellViewType>
321  void CellTools_mapToReferenceFrameInitGuessArgs( const refPointViewType refPoints,
322  const initGuessViewType initGuess,
323  const physPointViewType physPoints,
324  const worksetCellViewType worksetCell,
325  const shards::CellTopology cellTopo ) {
326  // Call the method that validates arguments with the default initial guess selection
327  CellTools_mapToReferenceFrameArgs(refPoints, physPoints, worksetCell, cellTopo);
328 
329  // Then check initGuess: its rank and dimensions must match those of physPoints.
330  INTREPID2_TEST_FOR_EXCEPTION( initGuess.rank() != physPoints.rank(), std::invalid_argument,
331  ">>> ERROR (Intrepid2::CellTools::mapToReferenceFrame): InitGuess must have the same rank as physPoints");
332 
333  const ordinal_type r = initGuess.rank();
334  for (ordinal_type i=0;i<r;++i) {
335  INTREPID2_TEST_FOR_EXCEPTION( initGuess.extent(i) != physPoints.extent(i), std::invalid_argument,
336  ">>> ERROR (Intrepid2::CellTools::mapToReferenceFrame): InitGuess dimension (i) does not match ot physPoints dimension(i).");
337  }
338  }
339 
340 
341 } // end of intrepid2
342 
343 #endif
344 
345 
346 
347 
348 
349 // template<class Scalar>
350 // template<class ArrayIncl, class ArrayPoint, class ArrayCell>
351 // void CellTools<Scalar>::checkPointwiseInclusion(ArrayIncl & inCell,
352 // const ArrayPoint & physPoints,
353 // const ArrayCell & worksetCell,
354 // const ordinal_type & whichCell,
355 // const shards::CellTopology & cell)
356 // {
357 // // Validate worksetCell array
358 // INTREPID2_TEST_FOR_EXCEPTION( (getrank(worksetCell) != 3), std::invalid_argument,
359 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): rank = 3 required for worksetCell array" );
360 
361 // INTREPID2_TEST_FOR_EXCEPTION( (static_cast<index_type>(worksetCell.extent(1)) != (index_type)cell.getSubcellCount(0) ), std::invalid_argument,
362 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): dim 1 (number of cell nodes) of worksetCell array does not match cell topology" );
363 
364 // INTREPID2_TEST_FOR_EXCEPTION( (static_cast<index_type>(worksetCell.extent(2)) != (index_type)cell.getDimension() ), std::invalid_argument,
365 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): dim 2 (spatial dimension) of worksetCell array does not match cell dimension" );
366 
367 
368 // // Validate whichCell It can be either -1 (default value) or a valid cell ordinal.
369 // INTREPID2_TEST_FOR_EXCEPTION( !( ( (0 <= whichCell ) && (whichCell < worksetCell.extent(0) ) ) || (whichCell == -1) ), std::invalid_argument,
370 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): whichCell = -1 or a valid cell ordinal is required." );
371 
372 // // Validate points array: can be rank-2 (P,D) or rank-3 (C,P,D)
373 // // If rank-2: admissible inCell is rank-1 (P); admissible whichCell is valid cell ordinal but not -1.
374 // if(getrank(physPoints) == 2) {
375 
376 // INTREPID2_TEST_FOR_EXCEPTION( (whichCell == -1), std::invalid_argument,
377 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): whichCell = a valid cell ordinal is required with rank-2 input array." );
378 
379 // INTREPID2_TEST_FOR_EXCEPTION( (static_cast<index_type>(physPoints.extent(1)) != (index_type)cell.getDimension() ), std::invalid_argument,
380 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): dim 1 (spatial dimension) of physPoints array does not match cell dimension" );
381 
382 // // Validate inCell
383 // INTREPID2_TEST_FOR_EXCEPTION( (getrank(inCell) != 1), std::invalid_argument,
384 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): rank = 1 required for inCell array" );
385 
386 // INTREPID2_TEST_FOR_EXCEPTION( (static_cast<index_type>(inCell.extent(0)) != static_cast<index_type>(physPoints.extent(0))), std::invalid_argument,
387 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): dim 0 (number of points) of inCell array must equal dim 0 of physPoints array" );
388 // }
389 // // If rank-3: admissible inCell is rank-2 (C,P); admissible whichCell = -1.
390 // else if (getrank(physPoints) == 3){
391 
392 // INTREPID2_TEST_FOR_EXCEPTION( !(whichCell == -1), std::invalid_argument,
393 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): whichCell = -1 is required with rank-3 input array." );
394 
395 // INTREPID2_TEST_FOR_EXCEPTION( (static_cast<index_type>(physPoints.extent(0)) != static_cast<index_type>(worksetCell.extent(0)) ), std::invalid_argument,
396 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): dim 0 (number of cells) of physPoints array must equal dim 0 of worksetCell array " );
397 
398 // INTREPID2_TEST_FOR_EXCEPTION( (static_cast<index_type>(physPoints.extent(2)) != (index_type)cell.getDimension() ), std::invalid_argument,
399 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): dim 2 (spatial dimension) of physPoints array does not match cell dimension" );
400 
401 // // Validate inCell
402 // INTREPID2_TEST_FOR_EXCEPTION( (getrank(inCell) != 2), std::invalid_argument,
403 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): rank = 2 required for inCell array" );
404 
405 // INTREPID2_TEST_FOR_EXCEPTION( (static_cast<index_type>(inCell.extent(0)) != static_cast<index_type>(physPoints.extent(0))), std::invalid_argument,
406 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): dim 0 (number of cells) of inCell array must equal dim 0 of physPoints array" );
407 
408 // INTREPID2_TEST_FOR_EXCEPTION( (static_cast<index_type>(inCell.extent(1)) != static_cast<index_type>(physPoints.extent(1))), std::invalid_argument,
409 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): dim 1 (number of points) of inCell array must equal dim 1 of physPoints array" );
410 // }
411 // else {
412 // INTREPID2_TEST_FOR_EXCEPTION( !( (getrank(physPoints) == 2) && (getrank(physPoints) ==3) ), std::invalid_argument,
413 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): rank = 2 or 3 required for points array" );
414 // }
415 // }