Skip to content
Snippets Groups Projects

Draft: Porting from C to Cpp using Multidimensional Subscript Operator

In ifos3d a 3D field e.g. vx is represented by the type float ***.

  • vx is an array of size nrow with elements of type float **
  • vx[.] is mapped to an array of size nrow * ncol with elements of float *
  • vx[.][.] is mapped to an array of nrow * ncol * ndep with elements of float
  • As the index of the fields may not start at zero, this data structure requires to substract offsets from the pointers, which may lead to pointer underflows.

With C++ multidimensional subscript operators this pointer underflow problem can be avoided and also the memory for the pointer structure can be saved.

Edited by Holger Obermaier

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading