3.3.3. Looping Over Cells in a Cell Thread (begin...end_c_loop)

You can use begin_c_loop and end_c_loop when you want to loop over all cells in a given cell thread. It contains a begin and end loop statement, and performs operation(s) on each cell in the cell thread as defined between the braces  . This loop is usually nested within thread_loop_c when you want to loop over all cells in all cell threads in a domain.

 cell_t c;
 Thread *c_thread;
 begin_c_loop(c, c_thread) /* loops over cells in a cell thread */
  {
  }
 end_c_loop(c, c_thread) 

Example

 /* Loop over cells in a thread to get information stored in cells. */
  begin_c_loop(c, c_thread)
  {
  /* C_T gets cell temperature. The += will cause all of the cell
   temperatures to be added together. */
   temp += C_T(c, c_thread);
  }
  end_c_loop(c, c_thread)
 } 

Release 18.2 - © ANSYS, Inc. All rights reserved.