20 #ifndef OPM_POINTERARITHMETIC_HPP 21 #define OPM_POINTERARITHMETIC_HPP 30 template <
class PtrType>
31 PtrType* ComputePtrBasedOnOffsetInOtherBuffer(PtrType* bufBStart, std::size_t bufBLength, PtrType* bufAStart, std::size_t bufALength, PtrType* ptrInA)
33 if (bufAStart ==
nullptr || bufBStart ==
nullptr || ptrInA ==
nullptr) {
34 throw std::invalid_argument(
"ComputePtrBasedOnOffsetInOtherBuffer: One or more input pointers are null.");
37 auto offset = ptrInA - bufAStart;
40 (static_cast<std::size_t>(offset) >= bufALength) ||
41 (static_cast<std::size_t>(offset) >= bufBLength))
43 throw std::out_of_range(
"ComputePtrBasedOnOffsetInOtherBuffer: Pointer into A is out of range.");
46 auto res = bufBStart + offset;
52 #endif // OPM_POINTERARITHMETIC_HPP This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30