petsc-3.7.7 2017-09-25
Report Typos and Errors

PetscIntMultTruncate

Computes the product of two positive PetscInt and truncates the value to slightly less than the maximal possible value

Synopsis

PETSC_STATIC_INLINE PetscInt PetscIntMultTruncate(PetscInt a,PetscInt b)
Not Collective

Input Parameter

a - the PetscInt value
b - the second value

Output Parameter

c -the result as a PetscInt value

Use PetscIntMult64bit() to compute the product of two PetscInt as a Petsc64bitInt Use PetscRealIntMultTruncate() to compute the product of a PetscReal and a PetscInt and truncate to fit a PetscInt Use PetscIntMultError() to compute the product of two PetscInt if you wish to generate an error if the result will not fit in a PetscInt

Developers Note: We currently assume that PetscInt addition can never overflow, this is obviously wrong but requires many more checks.

This is used where we compute approximate sizes for workspace and need to insure the workspace is index-able.

See Also

PetscBLASInt, PetscMPIInt, PetscInt, PetscBLASIntCast(), PetscIntMult64()

Level:advanced
Location:
include/petscsys.h
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages