Actual source code: absolute.c

petsc-master 2019-09-17
Report Typos and Errors

  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)
  6: {
  7:   VecTagger_Simple *smpl = (VecTagger_Simple *)tagger->data;
  8:   PetscInt       bs, i;
  9:   VecTaggerBox   *bxs;

 13:   VecTaggerGetBlockSize(tagger,&bs);
 14:   *numBoxes = 1;
 15:   PetscMalloc1(bs,&bxs);
 16:   for (i = 0; i < bs; i++) {
 17:     bxs[i].min = smpl->box[i].min;
 18:     bxs[i].max = smpl->box[i].max;
 19:   }
 20:   *boxes = bxs;
 21:   return(0);
 22: }

 24: /*@C
 25:   VecTaggerAbsoluteSetBox - Set the box defining the values to be tagged by the tagger.

 27:   Logically Collective

 29:   Input Arguments:
 30: + tagger - the VecTagger context
 31: - box - the box: a blocksize array of VecTaggerBox boxes

 33:   Level: advanced

 35: .seealso: VecTaggerAbsoluteGetBox()
 36: @*/
 37: PetscErrorCode VecTaggerAbsoluteSetBox(VecTagger tagger,VecTaggerBox *box)
 38: {

 42:   VecTaggerSetBox_Simple(tagger,box);
 43:   return(0);
 44: }

 46: /*@C
 47:   VecTaggerAbsoluteGetBox - Get the box defining the values to be tagged by the tagger.

 49:   Logically Collective

 51:   Input Arguments:
 52: . tagger - the VecTagger context

 54:   Output Arguments:
 55: . box - the box: a blocksize array of VecTaggerBox boxes

 57:   Level: advanced

 59: .seealso: VecTaggerAbsoluteSetBox()
 60: @*/
 61: PetscErrorCode VecTaggerAbsoluteGetBox(VecTagger tagger,const VecTaggerBox **box)
 62: {

 66:   VecTaggerGetBox_Simple(tagger,box);
 67:   return(0);
 68: }

 70: PETSC_INTERN PetscErrorCode VecTaggerCreate_Absolute(VecTagger tagger)
 71: {
 72:   PetscErrorCode     ierr;

 75:   VecTaggerCreate_Simple(tagger);
 76:   tagger->ops->computeboxes = VecTaggerComputeBoxes_Absolute;
 77:   return(0);
 78: }