Actual source code: vecnestimpl.h

  1: #ifndef PETSC_VECNESTIMPL_H
  2: #define PETSC_VECNESTIMPL_H

  4: #include <petsc/private/vecimpl.h>

  6: typedef struct {
  7:   PetscInt  nb; /* n blocks */
  8:   Vec      *v;
  9:   IS       *is;
 10:   PetscBool setup_called;
 11: } Vec_Nest;

 13: #if !defined(PETSC_CLANG_STATIC_ANALYZER)
 14:   #define VecNestCheckCompatible2(x, xarg, y, yarg) \
 15:     do { \
 18:       PetscCheckSameComm(x, xarg, y, yarg); \
 19:       PetscCheckSameType(x, xarg, y, yarg); \
 20:       PetscCheck(((Vec_Nest *)(x)->data)->setup_called, PetscObjectComm((PetscObject)x), PETSC_ERR_ARG_WRONG, "Nest vector argument %d not setup.", xarg); \
 21:       PetscCheck(((Vec_Nest *)(y)->data)->setup_called, PetscObjectComm((PetscObject)y), PETSC_ERR_ARG_WRONG, "Nest vector argument %d not setup.", yarg); \
 22:       PetscCheck(((Vec_Nest *)(x)->data)->nb == ((Vec_Nest *)(y)->data)->nb, PetscObjectComm((PetscObject)(x)), PETSC_ERR_ARG_WRONG, "Nest vector arguments %d and %d have different numbers of blocks.", xarg, yarg); \
 23:     } while (0)

 25:   #define VecNestCheckCompatible3(x, xarg, y, yarg, z, zarg) \
 26:     do { \
 30:       PetscCheckSameComm(x, xarg, y, yarg); \
 31:       PetscCheckSameType(x, xarg, y, yarg); \
 32:       PetscCheckSameComm(x, xarg, z, zarg); \
 33:       PetscCheckSameType(x, xarg, z, zarg); \
 34:       PetscCheck(((Vec_Nest *)(x)->data)->setup_called, PetscObjectComm((PetscObject)(x)), PETSC_ERR_ARG_WRONG, "Nest vector argument %d not setup.", xarg); \
 35:       PetscCheck(((Vec_Nest *)(y)->data)->setup_called, PetscObjectComm((PetscObject)(y)), PETSC_ERR_ARG_WRONG, "Nest vector argument %d not setup.", yarg); \
 36:       PetscCheck(((Vec_Nest *)(z)->data)->setup_called, PetscObjectComm((PetscObject)(z)), PETSC_ERR_ARG_WRONG, "Nest vector argument %d not setup.", zarg); \
 37:       PetscCheck(((Vec_Nest *)(x)->data)->nb == ((Vec_Nest *)(y)->data)->nb, PetscObjectComm((PetscObject)(x)), PETSC_ERR_ARG_WRONG, "Nest vector arguments %d and %d have different numbers of blocks.", xarg, yarg); \
 38:       PetscCheck(((Vec_Nest *)(x)->data)->nb == ((Vec_Nest *)(z)->data)->nb, PetscObjectComm((PetscObject)(x)), PETSC_ERR_ARG_WRONG, "Nest vector arguments %d and %d have different numbers of blocks.", xarg, zarg); \
 39:     } while (0)
 40: #else
 41: template <typename Tv>
 42: void VecNestCheckCompatible2(Tv, int, Tv, int);
 43: template <typename Tv>
 44: void VecNestCheckCompatible3(Tv, int, Tv, int, Tv, int);
 45: #endif

 47: #endif // PETSC_VECNESTIMPL_H