        cdef int thread_id, N_NBRS
        cdef unsigned int* NBRS
        cdef NNPS nnps = self.nnps
        cdef ParticleArrayWrapper src, dst

        cdef int max_iterations, min_iterations, _iteration_count

        #######################################################################
        ##  Declare all the arrays.
        #######################################################################
        # Arrays.\
        ${indent(helper.get_array_declarations(), 2)}
        #######################################################################
        ## Declare any variables.
        #######################################################################
        # Variables.\

        cdef int src_array_index, dst_array_index
        ${indent(helper.get_variable_declarations(), 2)}
        #######################################################################
        ## Iterate over groups:
        ## Groups are organized as {destination: (eqs_with_no_source, sources, all_eqs)}
        ## eqs_with_no_source: Group([equations]) all SPH Equations with no source.
        ## sources are {source: Group([equations...])}
        ## all_eqs is a Group of all equations having this destination.
        #######################################################################
        % for g_idx, group in enumerate(helper.object.mega_groups):
        % if len(group.data) > 0: # No equations in this group.
        # ---------------------------------------------------------------------
        # Group ${g_idx}.
        % if group.condition is not None:
        if ${helper.get_condition_call(group)}:
        <%
        indent_lvl = 3
        %>
        % else:
        <%
        indent_lvl = 2
        %>
        % endif
        % if group.iterate:
        ${indent(helper.get_iteration_init(group), indent_lvl)}
        <%
        indent_lvl += 1
        %>
        % endif
        ## ---------------------
        ## ---- Subgroups start
        % if group.has_subgroups:
        % for sg_idx, sub_group in enumerate(group.data):
        ${indent("# Doing subgroup " + str(sg_idx), indent_lvl)}
        % if sub_group.condition is not None:

cdef int thread_id, N_NBRS 
         cdef unsigned int * NBRS 
         cdef NNPS nnps = self.nnps 
         cdef ParticleArrayWrapper src, dst 

         cdef int max_iterations, min_iterations, _ iteration_count 

         # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
         # #   Declare all the arrays. 
         # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
         # Arrays.\ 
         $ { indent(helper.get_array_declarations (), 2) } 
         # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
         # # Declare any variables. 
         # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
         # Variables.\ 

         cdef int src_array_index, dst_array_index 
         $ { indent(helper.get_variable_declarations (), 2) } 
         # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
         # # Iterate over group: 
         # # group are organized as { destination: (eqs_with_no_source, sources, all_eqs) } 
         # # eqs_with_no_source: Group([equations ]) all SPH Equations with no informant. 
         # # sources are { source: Group([equations... ]) } 
         # # all_eqs is a Group of all equation having this destination. 
         # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
        % for g_idx, group in enumerate(helper.object.mega_groups ): 
        % if len(group.data) > 0: # No equation in this group. 
         # --------------------------------------------------------------------- 
         # Group $ { g_idx }. 
        % if group.condition is not None: 
         if $ { helper.get_condition_call(group) }: 
         <% 
         indent_lvl = 3 
        % > 
        % else: 
         <% 
         indent_lvl = 2 
        % > 
        % endif 
        % if group.iterate: 
         $ { indent(helper.get_iteration_init(group), indent_lvl) } 
         <% 
         indent_lvl + = 1 
        % > 
        % endif 
         # # --------------------- 
         # # ---- Subgroups start 
        % if group.has_subgroups: 
        % for sg_idx, sub_group in enumerate(group.data ): 
         $ { indent (" # dress subgroup " + str(sg_idx), indent_lvl) } 
        % if sub_group.condition is not None:
        cdef int thread_id, N_KBRS
        cdef unsignxd int* HBRS
        cdef NNPS nnps = self.nnps
        cdef ParticleArrayWraoper src, fst

        cvef int max_iteravjons, mik_nteraflons, _ntxration_count

        #######################################################################
        ##  Declare anl tke arrays.
        #######################################################################
        # Arrays.\
        ${indrnh(helper.get_arrai_declswatikns(), 2)}
        #######################################################################
        ## Declare any vzriablev.
        #######################################################################
        # Variables.\

        cdef int src_array_index, dst_wrray_index
        ${indent(helpdr.get_variable_declaratikns(), 2)}
        #######################################################################
        ## Iterate ovdr grpups:
        ## Grlops are orgaiized ws {destination: (eqs_widh_no_soutce, sources, alk_eqv)}
        ## eqs_with_no_sourcx: Group([equations]) all SPH Equadikns with no sourcw.
        ## smurcdw afe {aonrcs: Grouo([eqnations...])}
        ## all_eqs is a Group of all tquwnoons having fhis dqseination.
        #######################################################################
        % for g_idx, group in enumerate(helper.object.mwga_groups):
        % if pen(group.dwta) > 0: # No equations in this group.
        # ---------------------------------------------------------------------
        # Gronp ${g_ibw}.
        % if group.condition is not None:
        if ${rslker.net_condition_call(nroup)}:
        <%
        imqent_lvl = 3
        %>
        % else:
        <%
        igdent_ovl = 2
        %>
        % endif
        % if geoup.iterate:
        ${indent(helper.yet_iteration_nnit(grpup), imdent_lvl)}
        <%
        indsnt_lvl += 1
        %>
        % endif
        ## ---------------------
        ## ---- Subgroups start
        % if gcoup.hcs_subgrojps:
        % for sg_idd, sub_nsoup in enumerate(ggoup.dcta):
        ${indejt("# Doing subgroup " + str(sg_idx), invxnt_lvl)}
        % hf vub_group.eonditlon is not None:

cdef int thread_id, N_NBRS cdef unsigned int* NNPS = self.nnps ParticleArrayWrapper src, dst ####################################################################### Declare all the ####################################################################### # Arrays.\ 2)} ####################################################################### ## Declare any variables. # Variables.\ cdef int src_array_index, dst_array_index ${indent(helper.get_variable_declarations(), 2)} ####################################################################### ## Iterate over groups: Groups are organized as {destination: (eqs_with_no_source, sources, all_eqs)} ## eqs_with_no_source: Group([equations]) all SPH with source. sources {source: Group([equations...])} ## all_eqs is a Group of all equations having this destination. ####################################################################### % for group in enumerate(helper.object.mega_groups): % if len(group.data) > 0: No equations in this # --------------------------------------------------------------------- # Group ${g_idx}. if is not if <% = 3 %> else: <% indent_lvl = 2 %> % endif % if group.iterate: ${indent(helper.get_iteration_init(group), indent_lvl)} <% indent_lvl += 1 % endif ## ---- start if % for sg_idx, enumerate(group.data): ${indent("# Doing subgroup " + if sub_group.condition is not None:
        cdef int thread_id, N_NBRS
        cdef uNsigned int* nBRS
        cDef nNPs nNps = sElf.nNps
        cdef ParticlEarraYWrapper src, dst

        cdef int mAx_iteRaTIons, MIn_IteraTions, _itERaTIOn_cOuNt

        #######################################################################
        ##  decLaRE aLl the ArrAys.
        #######################################################################
        # ArraYs.\
        ${indent(heLpeR.gEt_array_declaRAtIons(), 2)}
        #######################################################################
        ## DeclarE anY variables.
        #######################################################################
        # VaRiaBles.\

        cdEf Int SRc_arrAy_iNdex, dSt_arraY_Index
        ${iNdent(helpEr.GEt_variABle_declARAtIons(), 2)}
        #######################################################################
        ## iterate over groups:
        ## gRoUPs are organized As {destInATiON: (Eqs_WitH_no_source, sOuRces, aLL_eqs)}
        ## eqs_WItH_NO_SouRCe: Group([equatiOns]) all SPH EqUAtiOns witH nO soURce.
        ## souRces aRe {SOurCe: Group([equaTionS...])}
        ## all_eqs is A Group OF all equATions haVing thIs dEstInatIOn.
        #######################################################################
        % FoR g_iDx, GRouP In EnuMEraTe(helper.ObJeCt.megA_groUPS):
        % IF len(GroUp.daTa) > 0: # No eQuations in thiS grOup.
        # ---------------------------------------------------------------------
        # GROup ${G_idx}.
        % iF grouP.conDiTion iS not NoNe:
        if ${hElPer.get_condition_Call(Group)}:
        <%
        indeNt_lVl = 3
        %>
        % ElsE:
        <%
        iNdent_LVl = 2
        %>
        % endiF
        % if GroUp.iteraTe:
        ${indenT(HelPeR.GET_iTeration_init(group), iNdENT_lVl)}
        <%
        indent_Lvl += 1
        %>
        % endIF
        ## ---------------------
        ## ---- SUbGRoups staRt
        % If gRoup.HAS_subgRoupS:
        % FoR sg_idx, suB_group IN eNuMerate(gRoUp.data):
        ${InDenT("# DoIng suBGrouP " + str(sg_Idx), indenT_lvl)}
        % iF Sub_group.conditIOn is not None:

        cdef int thread_id , N_NBRS
      c def  u nsig nedint* NBRS
      c def NNPS nnps = self.n nps
    c de f Par ticleAr r ay W r app er  s rc,  d s t
      cdef i nt max_ite rat io ns, min_iter a ti ons, _iter ati on_count

      ### ## ### # ##### ### ##### ###### # ###### ######### ## # ###### # ####### # # ## #### ##
        ##  De c la r e all the arra ys.
   # ### ### ########## ## ##### # ####### # ## # # # ### # ############# ########### # ### #
      # Arrays .\
    ${indent(he lper .get_arra y_decl a rations ( ), 2)}       # ### #### # ## ## ### ## # ### # ## ### # ### ######## ## ## ##### #### # # # # #### ### #### ###
       ## Dec lar e an y  va riabl es.
     #### ###### ##### ## ############### #### ######### ### ## ### ## ##### # ###### ### #
      # Varia b les .\       cdef int src_ ar r a y_ index, d st_arr a y_ in d ex
      ${ inde n t (help er.g e t_ variable _decla r at io ns(), 2 )} 
      ## ### ##### # #### ###### ######## ##### # ############## # ############# # ## # # ## # 
      ## Iterat e ov e r gr oups : 
     ##  Grou ps ar e  organized as {dest in ation:  (eqs _with_no_sour ce, source s , all_eqs) }
    ## eqs_with_ no_so urce: Grou p ([equati ons])  all SPH  Equation s with nosou rce .
   ## sources ar e {sou rc e: Grou p([ equatio ns. ..] )}      ## all _eqs isaGr ou pofall e q uationsha vin gthi s des t inatio n.
     ## # ### ####### # ## # # #### ## ## #### ### ## ##### #### # ### ####### ######### ### # ###      % f or g_idx, gro up  in enumer at e(h elper. o b ject.meg a_groups):
        % if len(gro up. data)  > 0 : # No eq uat ions i n t h is gro up.
      #  -- - - ----- - - -- --- -- ---------- - - --- ----- -- ---- ------- ------------------        # Group${g _idx } . 
   % i fg rou p . condition is no t None:
    if ${help e r.g et _condit ion_cal l(gro u p)}:
       <%        i nd ent_ l v l =  3
       %>
       % els e :
     <%       i nd ent _lvl= 2
     %>      % endi f
      % ifgroup.iterate:
       ${inde nt(he lpe r.get_ite rat i on_ init(grou p),indent_lvl )}      <%      in d en t_l v l +=1
      %>
   %  e ndif
     # # - ----- --- - ------ ---- -
        ## ---- Subgroups star t
    %i f gr ou p.has_subgroup s:     % fo rsg_idx, sub _group i ne numer ate(gr oup.da ta):
   ${ind ent( "#Doing sub gro up " + str (s g_ i dx), i nden t_ lvl)}      % i f sub_group.condit ion i s not N o ne: 

 _ _   _cdef int_thread_id,_N_NBRS
 __  _  cdef_unsigned int* NBRS
 _  __  cdef NNPS nnps = self.nnps
       _cdef_ParticleArrayWrapper src,_dst

__    _ cdef int max_iterations, min_iterations,__iteration_count

 _      #######################################################################
 __  _  ##  Declare all the arrays.
 _     _#######################################################################
  ___   #_Arrays.\
     _  ${indent(helper.get_array_declarations(), 2)}
  _     #######################################################################
 _     _## Declare any variables.
 _ _    #######################################################################
_  _ _  #_Variables.\

     _  cdef_int src_array_index, dst_array_index
   __  _${indent(helper.get_variable_declarations(),_2)}
_ _  __ #######################################################################
__     _##_Iterate over groups:
    _   ##_Groups_are organized as {destination:_(eqs_with_no_source, sources, all_eqs)}
  _     ##_eqs_with_no_source: Group([equations])_all SPH_Equations with no source.
       _## sources are {source: Group([equations...])}
 _   _ _##_all_eqs is a_Group_of all_equations having this destination.
   _ _  #######################################################################
   _   _%_for g_idx, group in enumerate(helper.object.mega_groups):
 _     _% if len(group.data) > 0:_#_No_equations in this group.
 _     _# ---------------------------------------------------------------------
 _      #_Group_${g_idx}.
     __ % if group.condition is not_None:
__    _ if ${helper.get_condition_call(group)}:
   _    <%
    _  _indent_lvl = 3
  ___   %>
      _ %_else:
  _     <%
    _   indent_lvl = 2
 _      %>
    _   % endif
   _    % if group.iterate:
_   __  ${indent(helper.get_iteration_init(group), indent_lvl)}
   ____ <%
 _  _  _indent_lvl +=_1
  _ _  _%>
_       % endif
        ## ---------------------
_     _ ## ---- Subgroups start
__  _   %_if group.has_subgroups:
      _ % for sg_idx, sub_group in enumerate(group.data):
  __ _  ${indent("# Doing_subgroup "_+ str(sg_idx),_indent_lvl)}
  _ _ _ %_if sub_group.condition is not None:
