Actual source code: absolute.c
2: #include <petsc/private/vecimpl.h>
3: #include "../src/vec/vec/utils/tagger/impls/simple.h"
5: static PetscErrorCode VecTaggerComputeBoxes_Absolute(VecTagger tagger, Vec vec, PetscInt *numBoxes, VecTaggerBox **boxes, PetscBool *listed)
6: {
7: VecTagger_Simple *smpl = (VecTagger_Simple *)tagger->data;
8: PetscInt bs, i;
9: VecTaggerBox *bxs;
11: PetscFunctionBegin;
12: PetscCall(VecTaggerGetBlockSize(tagger, &bs));
13: *numBoxes = 1;
14: PetscCall(PetscMalloc1(bs, &bxs));
15: for (i = 0; i < bs; i++) {
16: bxs[i].min = smpl->box[i].min;
17: bxs[i].max = smpl->box[i].max;
18: }
19: *boxes = bxs;
20: if (listed) *listed = PETSC_TRUE;
21: PetscFunctionReturn(PETSC_SUCCESS);
22: }
24: /*@C
25: VecTaggerAbsoluteSetBox - Set the box defining the values to be tagged by the tagger.
27: Logically Collective
29: Input Parameters:
30: + tagger - the `VecTagger` context
31: - box - the box: a blocksize array of `VecTaggerBox` boxes
33: Level: advanced
35: .seealso: `VecTagger`, `VecTaggerBox`, `VecTaggerAbsoluteGetBox()`
36: @*/
37: PetscErrorCode VecTaggerAbsoluteSetBox(VecTagger tagger, VecTaggerBox *box)
38: {
39: PetscFunctionBegin;
40: PetscCall(VecTaggerSetBox_Simple(tagger, box));
41: PetscFunctionReturn(PETSC_SUCCESS);
42: }
44: /*@C
45: VecTaggerAbsoluteGetBox - Get the box defining the values to be tagged by the tagger.
47: Logically Collective
49: Input Parameter:
50: . tagger - the `VecTagger` context
52: Output Parameter:
53: . box - the box: a blocksize array of `VecTaggerBox` boxes
55: Level: advanced
57: .seealso: `VecTagger`, `VecTaggerBox`, `VecTaggerAbsoluteSetBox()`
58: @*/
59: PetscErrorCode VecTaggerAbsoluteGetBox(VecTagger tagger, const VecTaggerBox **box)
60: {
61: PetscFunctionBegin;
62: PetscCall(VecTaggerGetBox_Simple(tagger, box));
63: PetscFunctionReturn(PETSC_SUCCESS);
64: }
66: PETSC_INTERN PetscErrorCode VecTaggerCreate_Absolute(VecTagger tagger)
67: {
68: PetscFunctionBegin;
69: PetscCall(VecTaggerCreate_Simple(tagger));
70: tagger->ops->computeboxes = VecTaggerComputeBoxes_Absolute;
71: PetscFunctionReturn(PETSC_SUCCESS);
72: }