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  const int startCell, const int endCell) {
74  // Validate worksetCell array
75  INTREPID2_TEST_FOR_EXCEPTION( worksetCell.rank() != 3, std::invalid_argument,
76  ">>> ERROR (Intrepid2::CellTools::setJacobian): rank = 3 required for worksetCell array." );
77  //TODO: check this. not working for composite tet
78  //INTREPID2_TEST_FOR_EXCEPTION( worksetCell.extent(1) != cellTopo.getSubcellCount(0), std::invalid_argument,
79  // ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 1 (number of cell nodes) of worksetCell array does not match cell topology." );
80 
81  INTREPID2_TEST_FOR_EXCEPTION( worksetCell.extent(2) != cellTopo.getDimension(), std::invalid_argument,
82  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 2 (spatial dimension) of worksetCell array does not match cell dimension." );
83 
84  // Validate points array: can be rank-2 (P,D) or rank-3 (C,P,D)
85  // If rank-2: admissible jacobians: rank-3 (P,D,D) or rank-4 (C,P,D,D); admissible whichCell: -1 (default) or cell ordinal.
86  const auto pointRank = points.rank();
87  INTREPID2_TEST_FOR_EXCEPTION( pointRank != 2 &&
88  pointRank != 3, std::invalid_argument,
89  ">>> ERROR (Intrepid2::CellTools::setJacobian): points must have rank 2 or 3." );
90 
91  const int endCellResolved = (endCell == -1) ? worksetCell.extent_int(0) : endCell;
92  const int numCells = endCellResolved - startCell;
93 
94  INTREPID2_TEST_FOR_EXCEPTION(startCell < 0, std::invalid_argument, "Invalid startCell");
95  INTREPID2_TEST_FOR_EXCEPTION(startCell >= worksetCell.extent_int(0), std::invalid_argument, "startCell is out of bounds in workset.");
96  INTREPID2_TEST_FOR_EXCEPTION(endCellResolved > worksetCell.extent_int(0), std::invalid_argument, "resolved endCell is out of bounds in workset.");
97 
98  switch (pointRank) {
99  case 2: {
100  INTREPID2_TEST_FOR_EXCEPTION( points.extent(1) != cellTopo.getDimension(), std::invalid_argument,
101  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 1 (spatial dimension) of points array does not match cell dimension." );
102 
103  INTREPID2_TEST_FOR_EXCEPTION( jacobian.rank() != 4, std::invalid_argument,
104  ">>> ERROR (Intrepid2::CellTools::setJacobian): rank = 4 required for jacobian array." );
105 
106  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent_int(0) != numCells, std::invalid_argument,
107  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 0 (number of cells) of jacobian array must equal number of cells requested from in the workset." );
108 
109  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(1) != points.extent(0), std::invalid_argument,
110  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 1 (number of points) of jacobian array must equal dim 0 of points array." );
111 
112  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(2) != points.extent(1), std::invalid_argument,
113  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 2 (spatial dimension) of jacobian array must equal dim 1 of points array." );
114 
115  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(2) != jacobian.extent(3), std::invalid_argument,
116  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 2 = dim 3 (same spatial dimensions) required for jacobian array." );
117 
118  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(3) < 1 || jacobian.extent(3) > 3, std::invalid_argument,
119  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 2 and dim 3 (spatial dimensions) must be between 1 and 3." );
120  break;
121  }
122  case 3: {
123  INTREPID2_TEST_FOR_EXCEPTION( points.extent_int(0) != numCells, std::invalid_argument,
124  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 0 (number of cells) of points array must equal number of cells requested from in the workset.");
125 
126  INTREPID2_TEST_FOR_EXCEPTION( points.extent(2) != cellTopo.getDimension(), std::invalid_argument,
127  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 2 (spatial dimension) of points array does not match cell dimension");
128 
129  // rank-4 (C,P,D,D) jacobian required for rank-3 (C,P,D) input points
130  INTREPID2_TEST_FOR_EXCEPTION( jacobian.rank() != 4, std::invalid_argument,
131  ">>> ERROR (Intrepid2::CellTools::setJacobian): rank = 4 required for jacobian array." );
132 
133  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(0) != points.extent(0), std::invalid_argument,
134  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 0 (number of cells) of jacobian array must equal dim 0 of points array");
135 
136  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(1) != points.extent(1), std::invalid_argument,
137  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 1 (number of points) of jacobian array must equal dim 1 of points array");
138 
139  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(2) != points.extent(2), std::invalid_argument,
140  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 2 (spatial dimension) of jacobian array must equal dim 2 of points array");
141 
142  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(2) != jacobian.extent(3), std::invalid_argument,
143  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 2 = dim 3 (same spatial dimensions) required for jacobian array. ");
144 
145  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(3) < 1 || jacobian.extent(3) > 3, std::invalid_argument,
146  ">>> ERROR (Intrepid2::CellTools::setJacobian): dim 2 and dim 3 (spatial dimensions) must be between 1 and 3." );
147  break;
148  }
149  }
150  }
151 
152  template<typename jacobianInvViewType,
153  typename jacobianViewType>
154  void
155  CellTools_setJacobianInvArgs( const jacobianInvViewType jacobianInv,
156  const jacobianViewType jacobian ) {
157  // Validate input jacobian array: admissible ranks & dimensions are:
158  // - rank-4 with dimensions (C,P,D,D), or rank-3 with dimensions (P,D,D).
159  const ordinal_type jacoRank = jacobian.rank();
160  INTREPID2_TEST_FOR_EXCEPTION( jacoRank != 4 &&
161  jacoRank != 3, std::invalid_argument,
162  ">>> ERROR (Intrepid2::CellTools::setJacobianInv): rank = 4 or 3 required for jacobian array." );
163 
164  // Verify correctness of spatial dimensions - they are the last two dimensions of the array: rank-2 and rank-1
165  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(jacoRank - 1) != jacobian.extent(jacoRank - 2), std::invalid_argument,
166  ">>> ERROR (Intrepid2::CellTools::setJacobianInv): dim(rank-2) = dim(rank-2) (same spatial dimensions) required for jacobian array." );
167 
168  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(jacoRank - 1) < 1 ||
169  jacobian.extent(jacoRank - 1) > 3, std::invalid_argument,
170  ">>> ERROR (Intrepid2::CellTools::setJacobianInv): dim(rank-1) and dim(rank-2) (spatial dimensions) must be between 1 and 3." );
171 
172  // Validate output jacobianInv array: must have the same rank and dimensions as the input array.
173  const ordinal_type jacoInvRank = jacobianInv.rank();
174  INTREPID2_TEST_FOR_EXCEPTION( jacoInvRank != jacoRank, std::invalid_argument,
175  ">>> ERROR (Intrepid2::CellTools::setJacobianInv): jacobian rank does not match to jacobianInv." );
176 
177  for (ordinal_type i=0;i<jacoRank;++i) {
178  INTREPID2_TEST_FOR_EXCEPTION( jacobianInv.extent(i) != jacobian.extent(i), std::invalid_argument,
179  ">>> ERROR (Intrepid2::CellTools::setJacobianInv): jacobian dimension (i) does not match to jacobianInv dimension (i)." );
180  }
181  }
182 
183 
184  template<typename jacobianDetViewType,
185  typename jacobianViewType>
186  void
187  CellTools_setJacobianDetArgs( const jacobianDetViewType jacobianDet,
188  const jacobianViewType jacobian ) {
189  // Validate input jacobian array: admissible ranks & dimensions are:
190  // - rank-4 with dimensions (C,P,D,D), or rank-3 with dimensions (P,D,D).
191  const ordinal_type jacoRank = jacobian.rank();
192  INTREPID2_TEST_FOR_EXCEPTION( jacoRank != 4 &&
193  jacoRank != 3, std::invalid_argument,
194  ">>> ERROR (Intrepid2::CellTools::setJacobianInv): rank = 4 or 3 required for jacobian array." );
195 
196  // Verify correctness of spatial dimensions - they are the last two dimensions of the array: rank-2 and rank-1
197  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(jacoRank - 1) != jacobian.extent(jacoRank - 2), std::invalid_argument,
198  ">>> ERROR (Intrepid2::CellTools::setJacobianInv): dim(rank-2) = dim(rank-2) (same spatial dimensions) required for jacobian array." );
199 
200  INTREPID2_TEST_FOR_EXCEPTION( jacobian.extent(jacoRank - 1) < 1 ||
201  jacobian.extent(jacoRank - 1) > 3, std::invalid_argument,
202  ">>> ERROR (Intrepid2::CellTools::setJacobianInv): dim(rank-1) and dim(rank-2) (spatial dimensions) must be between 1 and 3." );
203 
204  // Validate output jacobianDet array
205  const ordinal_type jacoDetRank = jacobianDet.rank();
206  // must be rank-2 with dimensions (C,P) if jacobian was rank-4
207  // must be rank-1 with dimension (P) if jacobian was rank-3
208  INTREPID2_TEST_FOR_EXCEPTION( jacoDetRank != (jacoRank-2), std::invalid_argument,
209  ">>> ERROR (Intrepid2::CellTools::setJacobianDetArgs): rank = 2 required for jacobianDet if jacobian is rank-4." );
210 
211  for (ordinal_type i=0;i<jacoDetRank;++i) {
212  INTREPID2_TEST_FOR_EXCEPTION( jacobianDet.extent(i) != jacobian.extent(i), std::invalid_argument,
213  ">>> ERROR (Intrepid2::CellTools::setJacobianDetArgs): jacobianDet dimension (i) does not match to jacobian dimension (i)." );
214  }
215  }
216 
217 
218 
219  template<typename physPointViewType,
220  typename refPointViewType,
221  typename worksetCellViewType>
222  void
223  CellTools_mapToPhysicalFrameArgs( const physPointViewType physPoints,
224  const refPointViewType refPoints,
225  const worksetCellViewType worksetCell,
226  const shards::CellTopology cellTopo ) {
227  // Validate worksetCell array
228  INTREPID2_TEST_FOR_EXCEPTION( (worksetCell.rank() != 3) || (physPoints.rank() != 3), std::invalid_argument,
229  ">>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): rank = 3 required for worksetCell and physPoints arrays." );
230 
231  //TODO: check this, not working for tria6
232  //INTREPID2_TEST_FOR_EXCEPTION( worksetCell.extent(1) != cellTopo.getSubcellCount(0), std::invalid_argument,
233  // ">>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): dim 1 (number of cell nodes) of worksetCell array does not match cell topology." );
234 
235  //we allow cells immersed in a higher-dimensional space (e.g. 2d cell in a 3d space)
236  INTREPID2_TEST_FOR_EXCEPTION( worksetCell.extent(2) < cellTopo.getDimension(), std::invalid_argument,
237  ">>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): dim 2 (spatial dimension) of worksetCell array is smaller than the cell dimension." );
238 
239  INTREPID2_TEST_FOR_EXCEPTION( physPoints.extent(2) != worksetCell.extent(2), std::invalid_argument,
240  ">>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): physPoints and worksetCell should have the same spatial dimension." );
241 
242 
243  // Validate refPoints array: can be rank-2 (P,D) or rank-3 (C,P,D) array
244  const ordinal_type refPointRank = refPoints.rank();
245  const ordinal_type physPointRank = physPoints.rank();
246 
247  INTREPID2_TEST_FOR_EXCEPTION( refPointRank != 2 &&
248  refPointRank != 3, std::invalid_argument,
249  ">>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): refPoints requires rank 2 or 3." );
250 
251  switch (refPointRank) {
252  case 2: {
253  // If rank-2: admissible output array is (P,D) or (C,P,D)
254  INTREPID2_TEST_FOR_EXCEPTION( refPoints.extent(1) != cellTopo.getDimension(), std::invalid_argument,
255  ">>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): dim 1 (spatial dimension) of refPoints array does not match cell dimension." );
256 
257  INTREPID2_TEST_FOR_EXCEPTION( physPoints.rank() != 3, std::invalid_argument,
258  ">>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): rank = 3 required for physPoints array for the default whichCell value." );
259 
260  INTREPID2_TEST_FOR_EXCEPTION( physPoints.extent(0) != worksetCell.extent(0), std::invalid_argument,
261  ">>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): dim 0 (number of cells) of physPoints array must equal dim 0 of worksetCell array." );
262 
263  INTREPID2_TEST_FOR_EXCEPTION( physPoints.extent(1) != refPoints.extent(0), std::invalid_argument,
264  ">>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): dim 1 (number of points) of physPoints array must equal dim 0 of refPoints array." );
265 
266 
267  break;
268  }
269  case 3: {
270  // refPoints is (C,P,D): requires physPoints to be (C,P,D) and whichCell=-1 (because all cell mappings are applied)
271  // validate refPoints dimensions and rank
272  INTREPID2_TEST_FOR_EXCEPTION( refPoints.extent(0) != worksetCell.extent(0), std::invalid_argument,
273  ">>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): dim 0 (number of cells) of refPoints and worksetCell arraya are required to match." );
274 
275  INTREPID2_TEST_FOR_EXCEPTION( refPoints.extent(2) != cellTopo.getDimension(), std::invalid_argument,
276  ">>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): dim 2 (spatial dimension) of refPoints array does not match cell dimension." );
277 
278  // physPoints must match rank and dimensions of refPoints
279  INTREPID2_TEST_FOR_EXCEPTION( refPointRank != physPointRank, std::invalid_argument,
280  " >>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): refPoints rank does not match to physPoints rank." );
281 
282  for (ordinal_type i=0;i<refPointRank-1;++i) {
283  INTREPID2_TEST_FOR_EXCEPTION( refPoints.extent(i) != physPoints.extent(i), std::invalid_argument,
284  " >>> ERROR (Intrepid2::CellTools::mapToPhysicalFrame): refPoints dimension(i) does not match to physPoints dimension(i)." );
285  }
286  break;
287  }
288  }
289  }
290 
291  template<typename refPointViewType,
292  typename physPointViewType,
293  typename worksetCellViewType>
294  void
295  CellTools_mapToReferenceFrameArgs( const refPointViewType refPoints,
296  const physPointViewType physPoints,
297  const worksetCellViewType worksetCell,
298  const shards::CellTopology cellTopo ) {
299  // Validate worksetCell array
300  const ordinal_type worksetCellRank = worksetCell.rank();
301  INTREPID2_TEST_FOR_EXCEPTION( worksetCellRank != 3, std::invalid_argument,
302  ">>> ERROR (Intrepid2::CellTools::mapToReferenceFrame): rank = 3 required for worksetCell array" );
303  // TODO: check this.
304  // INTREPID2_TEST_FOR_EXCEPTION( worksetCell.extent(1) != cellTopo.getSubcellCount(0), std::invalid_argument,
305  // ">>> ERROR (Intrepid2::CellTools::mapToReferenceFrame): dim 1 (number of cell nodes) of worksetCell array does not match cell topology" );
306 
307  INTREPID2_TEST_FOR_EXCEPTION( worksetCell.extent(2) != cellTopo.getDimension(), std::invalid_argument,
308  ">>> ERROR (Intrepid2::CellTools::mapToReferenceFrame): dim 2 (spatial dimension) of worksetCell array does not match cell dimension" );
309 
310  // Admissible ranks and dimensions of refPoints and physPoints depend on whichCell value:
311  // default is to map multiple sets of points to multiple sets of points. (C,P,D) arrays required
312 
313  const ordinal_type physPointRank = physPoints.rank();
314  const ordinal_type refPointRank = refPoints.rank();
315 
316  INTREPID2_TEST_FOR_EXCEPTION( refPointRank != 2 &&
317  refPointRank != 3, std::invalid_argument,
318  ">>> ERROR (Intrepid2::CellTools::mapToReferenceFrame): refPoint must have rank 2 or 3." );
319 
320  INTREPID2_TEST_FOR_EXCEPTION( physPointRank != refPointRank, std::invalid_argument,
321  ">>> ERROR (Intrepid2::CellTools::mapToReferenceFrame): physPoints rank does not match refPoints rank." );
322  for (ordinal_type i=0;i<refPointRank;++i) {
323  INTREPID2_TEST_FOR_EXCEPTION( refPoints.extent(i) != physPoints.extent(i), std::invalid_argument,
324  ">>> ERROR (Intrepid2::CellTools::mapToReferenceFrame): physPoints dimension (i) does not match refPoints dimension (i)." );
325  }
326  }
327 
328  template<typename refPointViewType,
329  typename initGuessViewType,
330  typename physPointViewType,
331  typename worksetCellViewType>
332  void CellTools_mapToReferenceFrameInitGuessArgs( const refPointViewType refPoints,
333  const initGuessViewType initGuess,
334  const physPointViewType physPoints,
335  const worksetCellViewType worksetCell,
336  const shards::CellTopology cellTopo ) {
337  // Call the method that validates arguments with the default initial guess selection
338  CellTools_mapToReferenceFrameArgs(refPoints, physPoints, worksetCell, cellTopo);
339 
340  // Then check initGuess: its rank and dimensions must match those of physPoints.
341  INTREPID2_TEST_FOR_EXCEPTION( initGuess.rank() != physPoints.rank(), std::invalid_argument,
342  ">>> ERROR (Intrepid2::CellTools::mapToReferenceFrame): InitGuess must have the same rank as physPoints");
343 
344  const ordinal_type r = initGuess.rank();
345  for (ordinal_type i=0;i<r;++i) {
346  INTREPID2_TEST_FOR_EXCEPTION( initGuess.extent(i) != physPoints.extent(i), std::invalid_argument,
347  ">>> ERROR (Intrepid2::CellTools::mapToReferenceFrame): InitGuess dimension (i) does not match ot physPoints dimension(i).");
348  }
349  }
350 
351 
352 } // end of intrepid2
353 
354 #endif
355 
356 
357 
358 
359 
360 // template<class Scalar>
361 // template<class ArrayIncl, class ArrayPoint, class ArrayCell>
362 // void CellTools<Scalar>::checkPointwiseInclusion(ArrayIncl & inCell,
363 // const ArrayPoint & physPoints,
364 // const ArrayCell & worksetCell,
365 // const ordinal_type & whichCell,
366 // const shards::CellTopology & cell)
367 // {
368 // // Validate worksetCell array
369 // INTREPID2_TEST_FOR_EXCEPTION( (getrank(worksetCell) != 3), std::invalid_argument,
370 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): rank = 3 required for worksetCell array" );
371 
372 // INTREPID2_TEST_FOR_EXCEPTION( (static_cast<index_type>(worksetCell.extent(1)) != (index_type)cell.getSubcellCount(0) ), std::invalid_argument,
373 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): dim 1 (number of cell nodes) of worksetCell array does not match cell topology" );
374 
375 // INTREPID2_TEST_FOR_EXCEPTION( (static_cast<index_type>(worksetCell.extent(2)) != (index_type)cell.getDimension() ), std::invalid_argument,
376 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): dim 2 (spatial dimension) of worksetCell array does not match cell dimension" );
377 
378 
379 // // Validate whichCell It can be either -1 (default value) or a valid cell ordinal.
380 // INTREPID2_TEST_FOR_EXCEPTION( !( ( (0 <= whichCell ) && (whichCell < worksetCell.extent(0) ) ) || (whichCell == -1) ), std::invalid_argument,
381 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): whichCell = -1 or a valid cell ordinal is required." );
382 
383 // // Validate points array: can be rank-2 (P,D) or rank-3 (C,P,D)
384 // // If rank-2: admissible inCell is rank-1 (P); admissible whichCell is valid cell ordinal but not -1.
385 // if(getrank(physPoints) == 2) {
386 
387 // INTREPID2_TEST_FOR_EXCEPTION( (whichCell == -1), std::invalid_argument,
388 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): whichCell = a valid cell ordinal is required with rank-2 input array." );
389 
390 // INTREPID2_TEST_FOR_EXCEPTION( (static_cast<index_type>(physPoints.extent(1)) != (index_type)cell.getDimension() ), std::invalid_argument,
391 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): dim 1 (spatial dimension) of physPoints array does not match cell dimension" );
392 
393 // // Validate inCell
394 // INTREPID2_TEST_FOR_EXCEPTION( (getrank(inCell) != 1), std::invalid_argument,
395 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): rank = 1 required for inCell array" );
396 
397 // INTREPID2_TEST_FOR_EXCEPTION( (static_cast<index_type>(inCell.extent(0)) != static_cast<index_type>(physPoints.extent(0))), std::invalid_argument,
398 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): dim 0 (number of points) of inCell array must equal dim 0 of physPoints array" );
399 // }
400 // // If rank-3: admissible inCell is rank-2 (C,P); admissible whichCell = -1.
401 // else if (getrank(physPoints) == 3){
402 
403 // INTREPID2_TEST_FOR_EXCEPTION( !(whichCell == -1), std::invalid_argument,
404 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): whichCell = -1 is required with rank-3 input array." );
405 
406 // INTREPID2_TEST_FOR_EXCEPTION( (static_cast<index_type>(physPoints.extent(0)) != static_cast<index_type>(worksetCell.extent(0)) ), std::invalid_argument,
407 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): dim 0 (number of cells) of physPoints array must equal dim 0 of worksetCell array " );
408 
409 // INTREPID2_TEST_FOR_EXCEPTION( (static_cast<index_type>(physPoints.extent(2)) != (index_type)cell.getDimension() ), std::invalid_argument,
410 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): dim 2 (spatial dimension) of physPoints array does not match cell dimension" );
411 
412 // // Validate inCell
413 // INTREPID2_TEST_FOR_EXCEPTION( (getrank(inCell) != 2), std::invalid_argument,
414 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): rank = 2 required for inCell array" );
415 
416 // INTREPID2_TEST_FOR_EXCEPTION( (static_cast<index_type>(inCell.extent(0)) != static_cast<index_type>(physPoints.extent(0))), std::invalid_argument,
417 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): dim 0 (number of cells) of inCell array must equal dim 0 of physPoints array" );
418 
419 // INTREPID2_TEST_FOR_EXCEPTION( (static_cast<index_type>(inCell.extent(1)) != static_cast<index_type>(physPoints.extent(1))), std::invalid_argument,
420 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): dim 1 (number of points) of inCell array must equal dim 1 of physPoints array" );
421 // }
422 // else {
423 // INTREPID2_TEST_FOR_EXCEPTION( !( (getrank(physPoints) == 2) && (getrank(physPoints) ==3) ), std::invalid_argument,
424 // ">>> ERROR (Intrepid2::CellTools::checkPointwiseInclusion): rank = 2 or 3 required for points array" );
425 // }
426 // }