Skip to content

Commit 497bda6

Browse files
authored
Merge pull request #1741 from CEED/jrwrigh/minor-docs
doc: Misc doc arrangement fixes
2 parents 47de8b8 + 6ab8e59 commit 497bda6

File tree

2 files changed

+59
-57
lines changed

2 files changed

+59
-57
lines changed

interface/ceed-basis.c

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,60 @@ static int CeedBasisCreateProjectionMatrices(CeedBasis basis_from, CeedBasis bas
291291
return CEED_ERROR_SUCCESS;
292292
}
293293

294+
/**
295+
@brief Check input vector dimensions for CeedBasisApply[Add]
296+
297+
@param[in] basis `CeedBasis` to evaluate
298+
@param[in] num_elem The number of elements to apply the basis evaluation to;
299+
the backend will specify the ordering in @ref CeedElemRestrictionCreate()
300+
@param[in] t_mode @ref CEED_NOTRANSPOSE to evaluate from nodes to quadrature points;
301+
@ref CEED_TRANSPOSE to apply the transpose, mapping from quadrature points to nodes
302+
@param[in] eval_mode @ref CEED_EVAL_NONE to use values directly,
303+
@ref CEED_EVAL_INTERP to use interpolated values,
304+
@ref CEED_EVAL_GRAD to use gradients,
305+
@ref CEED_EVAL_DIV to use divergence,
306+
@ref CEED_EVAL_CURL to use curl,
307+
@ref CEED_EVAL_WEIGHT to use quadrature weights
308+
@param[in] u Input `CeedVector`
309+
@param[out] v Output `CeedVector`
310+
311+
@return An error code: 0 - success, otherwise - failure
312+
313+
@ref Developer
314+
**/
315+
static int CeedBasisApplyCheckDims(CeedBasis basis, CeedInt num_elem, CeedTransposeMode t_mode, CeedEvalMode eval_mode, CeedVector u, CeedVector v) {
316+
CeedInt dim, num_comp, q_comp, num_nodes, num_qpts;
317+
CeedSize u_length = 0, v_length;
318+
319+
CeedCall(CeedBasisGetDimension(basis, &dim));
320+
CeedCall(CeedBasisGetNumComponents(basis, &num_comp));
321+
CeedCall(CeedBasisGetNumQuadratureComponents(basis, eval_mode, &q_comp));
322+
CeedCall(CeedBasisGetNumNodes(basis, &num_nodes));
323+
CeedCall(CeedBasisGetNumQuadraturePoints(basis, &num_qpts));
324+
CeedCall(CeedVectorGetLength(v, &v_length));
325+
if (u) CeedCall(CeedVectorGetLength(u, &u_length));
326+
327+
// Check vector lengths to prevent out of bounds issues
328+
bool has_good_dims = true;
329+
switch (eval_mode) {
330+
case CEED_EVAL_NONE:
331+
case CEED_EVAL_INTERP:
332+
case CEED_EVAL_GRAD:
333+
case CEED_EVAL_DIV:
334+
case CEED_EVAL_CURL:
335+
has_good_dims = ((t_mode == CEED_TRANSPOSE && u_length >= (CeedSize)num_elem * (CeedSize)num_comp * (CeedSize)num_qpts * (CeedSize)q_comp &&
336+
v_length >= (CeedSize)num_elem * (CeedSize)num_comp * (CeedSize)num_nodes) ||
337+
(t_mode == CEED_NOTRANSPOSE && v_length >= (CeedSize)num_elem * (CeedSize)num_qpts * (CeedSize)num_comp * (CeedSize)q_comp &&
338+
u_length >= (CeedSize)num_elem * (CeedSize)num_comp * (CeedSize)num_nodes));
339+
break;
340+
case CEED_EVAL_WEIGHT:
341+
has_good_dims = v_length >= (CeedSize)num_elem * (CeedSize)num_qpts;
342+
break;
343+
}
344+
CeedCheck(has_good_dims, CeedBasisReturnCeed(basis), CEED_ERROR_DIMENSION, "Input/output vectors too short for basis and evaluation mode");
345+
return CEED_ERROR_SUCCESS;
346+
}
347+
294348
/**
295349
@brief Check input vector dimensions for CeedBasisApply[Add]AtPoints
296350
@@ -1866,60 +1920,6 @@ int CeedBasisView(CeedBasis basis, FILE *stream) {
18661920
return CEED_ERROR_SUCCESS;
18671921
}
18681922

1869-
/**
1870-
@brief Check input vector dimensions for CeedBasisApply[Add]
1871-
1872-
@param[in] basis `CeedBasis` to evaluate
1873-
@param[in] num_elem The number of elements to apply the basis evaluation to;
1874-
the backend will specify the ordering in @ref CeedElemRestrictionCreate()
1875-
@param[in] t_mode @ref CEED_NOTRANSPOSE to evaluate from nodes to quadrature points;
1876-
@ref CEED_TRANSPOSE to apply the transpose, mapping from quadrature points to nodes
1877-
@param[in] eval_mode @ref CEED_EVAL_NONE to use values directly,
1878-
@ref CEED_EVAL_INTERP to use interpolated values,
1879-
@ref CEED_EVAL_GRAD to use gradients,
1880-
@ref CEED_EVAL_DIV to use divergence,
1881-
@ref CEED_EVAL_CURL to use curl,
1882-
@ref CEED_EVAL_WEIGHT to use quadrature weights
1883-
@param[in] u Input `CeedVector`
1884-
@param[out] v Output `CeedVector`
1885-
1886-
@return An error code: 0 - success, otherwise - failure
1887-
1888-
@ref Developer
1889-
**/
1890-
static int CeedBasisApplyCheckDims(CeedBasis basis, CeedInt num_elem, CeedTransposeMode t_mode, CeedEvalMode eval_mode, CeedVector u, CeedVector v) {
1891-
CeedInt dim, num_comp, q_comp, num_nodes, num_qpts;
1892-
CeedSize u_length = 0, v_length;
1893-
1894-
CeedCall(CeedBasisGetDimension(basis, &dim));
1895-
CeedCall(CeedBasisGetNumComponents(basis, &num_comp));
1896-
CeedCall(CeedBasisGetNumQuadratureComponents(basis, eval_mode, &q_comp));
1897-
CeedCall(CeedBasisGetNumNodes(basis, &num_nodes));
1898-
CeedCall(CeedBasisGetNumQuadraturePoints(basis, &num_qpts));
1899-
CeedCall(CeedVectorGetLength(v, &v_length));
1900-
if (u) CeedCall(CeedVectorGetLength(u, &u_length));
1901-
1902-
// Check vector lengths to prevent out of bounds issues
1903-
bool has_good_dims = true;
1904-
switch (eval_mode) {
1905-
case CEED_EVAL_NONE:
1906-
case CEED_EVAL_INTERP:
1907-
case CEED_EVAL_GRAD:
1908-
case CEED_EVAL_DIV:
1909-
case CEED_EVAL_CURL:
1910-
has_good_dims = ((t_mode == CEED_TRANSPOSE && u_length >= (CeedSize)num_elem * (CeedSize)num_comp * (CeedSize)num_qpts * (CeedSize)q_comp &&
1911-
v_length >= (CeedSize)num_elem * (CeedSize)num_comp * (CeedSize)num_nodes) ||
1912-
(t_mode == CEED_NOTRANSPOSE && v_length >= (CeedSize)num_elem * (CeedSize)num_qpts * (CeedSize)num_comp * (CeedSize)q_comp &&
1913-
u_length >= (CeedSize)num_elem * (CeedSize)num_comp * (CeedSize)num_nodes));
1914-
break;
1915-
case CEED_EVAL_WEIGHT:
1916-
has_good_dims = v_length >= (CeedSize)num_elem * (CeedSize)num_qpts;
1917-
break;
1918-
}
1919-
CeedCheck(has_good_dims, CeedBasisReturnCeed(basis), CEED_ERROR_DIMENSION, "Input/output vectors too short for basis and evaluation mode");
1920-
return CEED_ERROR_SUCCESS;
1921-
}
1922-
19231923
/**
19241924
@brief Apply basis evaluation from nodes to quadrature points or vice versa
19251925

interface/ceed-operator.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ int CeedOperatorGetActiveElemRestrictions(CeedOperator op, CeedElemRestriction *
354354
355355
@return An error code: 0 - success, otherwise - failure
356356
357-
@ref User
357+
@ref Developer
358358
**/
359359
static int CeedOperatorContextSetGeneric(CeedOperator op, CeedContextFieldLabel field_label, CeedContextFieldType field_type, void *values) {
360360
bool is_composite = false;
@@ -417,7 +417,7 @@ static int CeedOperatorContextSetGeneric(CeedOperator op, CeedContextFieldLabel
417417
418418
@return An error code: 0 - success, otherwise - failure
419419
420-
@ref User
420+
@ref Developer
421421
**/
422422
static int CeedOperatorContextGetGenericRead(CeedOperator op, CeedContextFieldLabel field_label, CeedContextFieldType field_type, size_t *num_values,
423423
void *values) {
@@ -484,7 +484,7 @@ static int CeedOperatorContextGetGenericRead(CeedOperator op, CeedContextFieldLa
484484
485485
@return An error code: 0 - success, otherwise - failure
486486
487-
@ref User
487+
@ref Developer
488488
**/
489489
static int CeedOperatorContextRestoreGenericRead(CeedOperator op, CeedContextFieldLabel field_label, CeedContextFieldType field_type, void *values) {
490490
bool is_composite = false;
@@ -1561,6 +1561,8 @@ int CeedOperatorSetName(CeedOperator op, const char *name) {
15611561
@param[in] is_full Whether to write full operator view or terse
15621562
15631563
@return Error code: 0 - success, otherwise - failure
1564+
1565+
@ref Developer
15641566
**/
15651567
static int CeedOperatorView_Core(CeedOperator op, FILE *stream, bool is_full) {
15661568
bool has_name = op->name, is_composite, is_at_points;

0 commit comments

Comments
 (0)