@@ -1548,34 +1548,77 @@ int CeedElemRestrictionGetNumPointsInElement(CeedElemRestriction rstr, CeedInt e
15481548}
15491549
15501550/**
1551- @brief Get the maximum number of points in an element for a `CeedElemRestriction` at points
1551+ @brief Get the minimum and/or maximum number of points in an element for a `CeedElemRestriction` at points
15521552
15531553 @param[in] rstr `CeedElemRestriction`
1554- @param[out] max_points Variable to store size of elements
1554+ @param[out] min_points Variable to minimum number of points in an element, or `NULL`
1555+ @param[out] max_points Variable to maximum number of points in an element, or `NULL`
15551556
15561557 @return An error code: 0 - success, otherwise - failure
15571558
15581559 @ref Advanced
15591560**/
1560- int CeedElemRestrictionGetMaxPointsInElement (CeedElemRestriction rstr , CeedInt * max_points ) {
1561- CeedInt num_elem ;
1561+ int CeedElemRestrictionGetMinMaxPointsInElement (CeedElemRestriction rstr , CeedInt * min_points , CeedInt * max_points ) {
1562+ CeedInt num_elem , num_points ;
15621563 CeedRestrictionType rstr_type ;
15631564
15641565 CeedCall (CeedElemRestrictionGetType (rstr , & rstr_type ));
15651566 CeedCheck (rstr_type == CEED_RESTRICTION_POINTS , CeedElemRestrictionReturnCeed (rstr ), CEED_ERROR_INCOMPATIBLE ,
1566- "Cannot compute max points for a CeedElemRestriction that does not use points" );
1567+ "Cannot compute min/ max points for a CeedElemRestriction that does not use points" );
15671568
15681569 CeedCall (CeedElemRestrictionGetNumElements (rstr , & num_elem ));
1569- * max_points = 0 ;
1570- for (CeedInt e = 0 ; e < num_elem ; e ++ ) {
1571- CeedInt num_points ;
15721570
1571+ // Exit early if there are no elements
1572+ if (num_elem == 0 ) {
1573+ if (min_points ) * min_points = 0 ;
1574+ if (max_points ) * max_points = 0 ;
1575+ return CEED_ERROR_SUCCESS ;
1576+ }
1577+
1578+ // Initialize to the number of points in the first element
1579+ CeedCall (CeedElemRestrictionGetNumPointsInElement (rstr , 0 , & num_points ));
1580+ if (min_points ) * min_points = num_points ;
1581+ if (max_points ) * max_points = num_points ;
1582+ for (CeedInt e = 1 ; e < num_elem ; e ++ ) {
15731583 CeedCall (CeedElemRestrictionGetNumPointsInElement (rstr , e , & num_points ));
1574- * max_points = CeedIntMax (num_points , * max_points );
1584+ if (min_points ) * min_points = CeedIntMin (num_points , * min_points );
1585+ if (max_points ) * max_points = CeedIntMax (num_points , * max_points );
15751586 }
15761587 return CEED_ERROR_SUCCESS ;
15771588}
15781589
1590+ /**
1591+ @brief Get the maximum number of points in an element for a `CeedElemRestriction` at points
1592+
1593+ @param[in] rstr `CeedElemRestriction`
1594+ @param[out] max_points Variable to store maximum number of points in an element
1595+
1596+ @return An error code: 0 - success, otherwise - failure
1597+
1598+ @ref User
1599+
1600+ @see CeedElemRestrictionGetMinMaxPointsInElement()
1601+ **/
1602+ int CeedElemRestrictionGetMaxPointsInElement (CeedElemRestriction rstr , CeedInt * max_points ) {
1603+ return CeedElemRestrictionGetMinMaxPointsInElement (rstr , NULL , max_points );
1604+ }
1605+
1606+ /**
1607+ @brief Get the minimum number of points in an element for a `CeedElemRestriction` at points
1608+
1609+ @param[in] rstr `CeedElemRestriction`
1610+ @param[out] min_points Variable to store minimum number of points in an element
1611+
1612+ @return An error code: 0 - success, otherwise - failure
1613+
1614+ @ref User
1615+
1616+ @see CeedElemRestrictionGetMinMaxPointsInElement()
1617+ **/
1618+ int CeedElemRestrictionGetMinPointsInElement (CeedElemRestriction rstr , CeedInt * min_points ) {
1619+ return CeedElemRestrictionGetMinMaxPointsInElement (rstr , min_points , NULL );
1620+ }
1621+
15791622/**
15801623 @brief Get the size of the l-vector for a `CeedElemRestriction`
15811624
0 commit comments