Actual source code: vecnestimpl.h

  1: #pragma once

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

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

 12: #if !defined(PETSC_CLANG_STATIC_ANALYZER)
 13:   #define VecNestCheckCompatible2(x, xarg, y, yarg) \
 14:     do { \
 17:       PetscCheckTypeName(x, VECNEST); \
 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:       PetscCheckTypeName(x, VECNEST); \
 31:       PetscCheckSameComm(x, xarg, y, yarg); \
 32:       PetscCheckSameType(x, xarg, y, yarg); \
 33:       PetscCheckSameComm(x, xarg, z, zarg); \
 34:       PetscCheckSameType(x, xarg, z, zarg); \
 35:       PetscCheck(((Vec_Nest *)(x)->data)->setup_called, PetscObjectComm((PetscObject)(x)), PETSC_ERR_ARG_WRONG, "Nest vector argument %d not setup.", xarg); \
 36:       PetscCheck(((Vec_Nest *)(y)->data)->setup_called, PetscObjectComm((PetscObject)(y)), PETSC_ERR_ARG_WRONG, "Nest vector argument %d not setup.", yarg); \
 37:       PetscCheck(((Vec_Nest *)(z)->data)->setup_called, PetscObjectComm((PetscObject)(z)), PETSC_ERR_ARG_WRONG, "Nest vector argument %d not setup.", zarg); \
 38:       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); \
 39:       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); \
 40:     } while (0)
 41: #else
 42: template <typename Tv>
 43: extern void VecNestCheckCompatible2(Tv, int, Tv, int);
 44: template <typename Tv>
 45: extern void VecNestCheckCompatible3(Tv, int, Tv, int, Tv, int);
 46: #endif