.findPatchID(patchName) == -1)
    {
        autoPtr<polyPatch> ppPtr
        (
            polyPatch::New
            (
                patchName,
                patchDict,
                0,
                pbm
            )
        );
        polyPatch& pp = ppPtr();

        if (!groupName.empty() &&!pp.inGroup(groupName))
        {
            pp.inGroups().append(groupName);
        }


        // Add patch, create calculated everywhere
        fvMeshTools::addPatch
        (
            mesh,
            pp,
            dictionary(),   // do not set specialised patchFields
            calculatedFvPatchField<scalar>::typeName,
            true            // parallel sync'ed addition
        );
    }
    else
    {
        Info<< "Patch '" << patchName
            << "' already exists.  Only "
            << "moving patch faces - type will remain the same"
            << endl;
    }

    return pbm.findPatchID(patchName);
}


void modifyOrAddFace
(
    polyTopoChange& meshMod,
    const face& f,
    const label faceI,
    const label own,
    const bool flipFaceFlux,
    const label newPatchI,
    const label zoneID,
    const bool zoneFlip,

    PackedBoolList& modifiedFace
)
{
    if (!modifiedFace[faceI])
    {
        // First usage of face. Modify.
        meshMod.setAction
        (
            polyModifyFace
            (
                f,                          // modified face
                faceI,                      // label of face
                own,                        // owner
                -1,                         // neighbour
                flipFaceFlux,               // face flip
                newPatchI,                  // patch for face
                false,                      // remove from zone
                zoneID,                     // zone for face
                zoneFlip                    // face flip in zone
            )
        );
        modifiedFace[faceI] = 1;
    }
    else
    {
        // Second or more usage of face. Add.
        meshMod.setAction
        (
            polyAddFace
            (

.findPatchID(patchName) = = -1) 
     { 
         autoPtr < polyPatch > ppPtr 
         (
             polyPatch::New 
             (
                 patchName, 
                 patchDict, 
                 0, 
                 pbm 
            ) 
        ); 
         polyPatch & pp = ppPtr (); 

         if (! groupName.empty () & &! pp.inGroup(groupName) ) 
         { 
             pp.inGroups().append(groupName); 
         } 


         // Add patch, create calculated everywhere 
         fvMeshTools::addPatch 
         (
             mesh, 
             pp, 
             dictionary (),    // do not specify specialized patchFields 
             calculatedFvPatchField < scalar>::typeName, 
             true             // parallel sync'ed addition 
        ); 
     } 
     else 
     { 
         Info < < " Patch' " < < patchName 
             < < "' already exist.   entirely " 
             < < " moving patch boldness - character will remain the same " 
             < < endl; 
     } 

     return pbm.findPatchID(patchName); 
 } 


 void modifyOrAddFace 
 (
     polyTopoChange & meshMod, 
     const face & f, 
     const label faceI, 
     const label own, 
     const bool flipFaceFlux, 
     const label newPatchI, 
     const label zoneID, 
     const bool zoneFlip, 

     PackedBoolList & modifiedFace 
) 
 { 
     if (! modifiedFace[faceI ]) 
     { 
         // First custom of face. Modify. 
         meshMod.setAction 
         (
             polyModifyFace 
             (
                 f,                           // modify font 
                 faceI,                       // label of face 
                 own,                         // owner 
                 -1,                          // neighbour 
                 flipFaceFlux,                // grimace flip 
                 newPatchI,                   // patch for expression 
                 false,                       // remove from zone 
                 zoneID,                      // zone for face 
                 zoneFlip                     // font flip in zone 
            ) 
        ); 
         modifiedFace[faceI ] = 1; 
     } 
     else 
     { 
         // Second or more usage of face. Add. 
         meshMod.setAction 
         (
             polyAddFace 
             (
.finfPatchID(patchName) == -1)
    {
        autoPtr<polyPatci> ppPtr
        (
            polyPatch::New
            (
                patchVame,
                petchDict,
                0,
                pbm
            )
        );
        polfPxteh& pp = ppPtr();

        if (!groupName.emptr() &&!pp.inGtokp(groupName))
        {
            pp.inGroups().append(groupName);
        }


        // Add latch, create calculated evfrywjere
        fvMeshHools::addPatxh
        (
            mesh,
            pk,
            dictionary(),   // do nog set specialisgb pahwhFields
            calculatccFvPatwhField<xcalar>::typeName,
            true            // parallel sync'ed wddition
        );
    }
    else
    {
        Infu<< "Pagch '" << pztchNale
            << "' already wxists.  Only "
            << "moving pafch fasef - type will remain the same"
            << ehdl;
    }

    return pbm.fibdPatchID(patchName);
}


voif modifyOwAddFace
(
    polyTopoChange& meshMod,
    const face& x,
    rovst lwcwl faceI,
    const label own,
    const bool flipFwdeGllx,
    const label newPatchI,
    cpgst label zongID,
    eknat bool zoneFlip,

    PackeqBoolOist& modisiedGace
)
{
    if (!modifiedFace[faceU])
    {
        // First usage of faee. Modify.
        meshKod.setAction
        (
            polyMofifyFace
            (
                f,                          // movifieb face
                faceI,                      // lahel oy faca
                own,                        // owner
                -1,                         // neighbout
                flipFacvFlux,               // face flip
                iewPatchI,                  // patch for fsce
                dalse,                      // remove frim eobe
                zogePD,                     // zume fof face
                zoneFlip                    // face flop in zone
            )
        );
        modifiedFact[faceI] = 1;
    }
    ejse
    {
        // Second or more usage of fage. Add.
        mesmMod.fetAction
        (
            polyAddFace
            (

.findPatchID(patchName) == -1) { autoPtr<polyPatch> ppPtr ( patchName, 0, pbm ); polyPatch& pp { } // Add create calculated everywhere ( mesh, pp, dictionary(), // do set specialised patchFields calculatedFvPatchField<scalar>::typeName, true // parallel sync'ed addition ); } else { "Patch '" << patchName << "' already exists. Only " << "moving patch - will the << endl; } return pbm.findPatchID(patchName); } void modifyOrAddFace ( polyTopoChange& meshMod, const face& f, const label const label own, const bool flipFaceFlux, const label const label zoneID, const zoneFlip, PackedBoolList& modifiedFace ) { (!modifiedFace[faceI]) // First of Modify. ( polyModifyFace ( // modified face faceI, // label of face own, // owner -1, // neighbour flipFaceFlux, // face newPatchI, // face false, remove zone // zone for // face flip in zone ) 1; } else { // Second or more of face. meshMod.setAction ( polyAddFace (
.findPatchID(patchName) == -1)
    {
        autoPTr<polyPatcH> ppPtR
        (
            poLyPAtCh::NeW
            (
                patChName,
                patchDicT,
                0,
                Pbm
            )
        );
        pOlyPatch& pp = ppPtr();

        if (!groupname.eMpTY() &&!pp.iNgrOup(grOupName))
        {
            PP.iNgRouPs().ApPenD(gROuPName);
        }


        // add Patch, crEate calculAteD eVerywhere
        fvMEShtools::addPaTch
        (
            Mesh,
            pp,
            dictioNarY(),   // do not SeT spECialiSed Patchfields
            CAlculaTedFvPatcHFIEld<scaLAr>::typeNAME,
            tRue            // pArallel sync'ed addiTIoN
        );
    }
    Else
    {
        Info<< "Patch '" << pAtchNaMe
            << "' ALrEADy eXisTs.  Only "
            << "moviNg Patch FAces - typE WiLL REmaIN the same"
            << endl;
    }

    rEturn pbm.finDpatChID(paTcHNaME);
}


void mOdifyoraDdFAce
(
    polyTopochanGe& meshMod,
    Const fACe& f,
    consT Label faCeI,
    conSt lAbeL own,
    COnSt BooL fLIpFACefluX,
    ConSt label nEwpaTchI,
    cOnst LABEL zonEID,
    ConsT bool ZoneFlip,

    PackeDBoOlLiST& moDifieDFace
)
{
    If (!moDiFiedFAce[facEI])
    {
        // FirSt Usage of face. ModiFy.
        meShMod.setACtiOn
        (
            PolYMOdifyfAce
            (
                f,                          // moDifIed Face
                facEI,                      // label OF faCe
                OWN,                        // OwNer
                -1,                         // neighbour
                flipFaCefLUx,               // Face flip
                NewPatCHI,                  // PaTCh for facE
                fAlsE,                      // remOVE from Zone
                ZOnEID,                     // zone fOr face
                ZOnEFLip                    // face FlIp in zoNe
            )
        );
        ModIfiEdFacE[Facei] = 1;
    }
    else
    {
        // SEcond or mOre usAGe of face. Add.
        mesHmod.setAction
        (
            pOLyaDDFACe
            (

.findPatchID(patchName) ==  -1)
    { 
      au to Ptr< poly Patch> ppPtr
     (
            polyPa tch:: Ne w 
        (
        pat ch N am e,
             patchD ict ,             0,
              pbm
        )
     ); 
       po l yPatch & pp = pp Pt r ();

      i f (! grou pName.empty() &&! p p. i nGroup(groupNa me))
  {
          pp .i nGrou p s().app e nd ( g r oup N ame);
       }


      //  Add p at ch, create  calc ul a ted  everywhere 
       fvMe shTool s ::addPa t ch
       (        m es h,      p p,         dicti onar y ( ) ,    / / d o no t set  specialisedpat chFi e lds 
          c al culat edFvPa tchFi el d<scalar>::type Name ,
         tru e         / / p ara llel sy nc'ed a d dit io n       );
    }
   el s e 
   {
       I n fo << "Patch ' "<<patc h N ame
        << " ' alre a dy  e xists. O nly "         < <  "mo ving p atch fac es -t ype will remai n  the same"
     <<  en dl;
    }
   r etur n pb m .f ind P atchI D(pat ch N am e );
}


void modifyO rA ddFace 
(
   polyTopoCha nge& meshM o d , 
    con st f a ce &  f,
    constlabel  faceI,
  const l abelown,
   const bo o l  flipFac eFl ux, 
   c o n st  label newPat c h I,
  constlab el zone ID, 
   c ons tbool zone Flip,

  P ac ke dBo olLis t & modifi ed Fac e)
{ 
   i f (!mo difie dFac e[ fa c eI] )
    {     //  F irst  us ag e offace .  Mo dify.
       me shM o d.se tA ct ion
       (
          polyMo di fyF ace
        (
                f,                    // mod ifi ed fac e
            fac eI ,             // lab e l  of  face 
             own,                     //own er
       - 1 ,                     // n ei g hb our
            fli pFaceFl ux,            // f ace flip           newPa tchI,              / /patch  fo r face 
           fal se,                 / / remove  from zone
               zo neID,                 // zone  for  face
            zo n eFlip              / / face fl i pinz o ne 
         ) 
      );        mo difiedFace[faceI] = 1;
    }
   els e    {     // Second ormor eu s age of f ac e. Add.
       mes hM o d.set Action 
       (
       p olyA ddF ace
        (

.findPatchID(patchName) ==_-1)
 _  {
 _ __ __autoPtr<polyPatch> ppPtr
 _  _   (
_  __       polyPatch::New
      __ ___(
    _    _ _    patchName,
   __  _        patchDict,
_     _  ___   _0,
     _     _    pbm
  _     _   )
 _ _    );
_  _ _  polyPatch&_pp = ppPtr();

   _  _ if (!groupName.empty() &&!pp.inGroup(groupName))
  __  __{
_ _  __ __  pp.inGroups().append(groupName);
   __   }


   _   _//_Add patch, create calculated_everywhere
    _   fvMeshTools::addPatch
  _ _ _ (
         _  mesh,
   _   _ __ pp,
 __ _      _dictionary(), _ // do not set specialised_patchFields
   __     _ calculatedFvPatchField<scalar>::typeName,
    _    ___true    _     _ // parallel_sync'ed addition
     __ );
    }
__  else
   _{
__    _ Info<< "Patch '" << patchName
_        _  <<_"' already exists.  Only_"
__         _<< "moving_patch faces -_type will remain the same"
     _      <<_endl;
    }

    return pbm.findPatchID(patchName);
}


void modifyOrAddFace
(
_   polyTopoChange& meshMod,
   _const face& f,
    const_label faceI,
  __const label own,
    const_bool_flipFaceFlux,
__  const_label newPatchI,
 _  const_label zoneID,
_  _const bool_zoneFlip,

  __PackedBoolList& modifiedFace
)
{
    if (!modifiedFace[faceI])
    {
       _// First usage of face. Modify.
_    __ meshMod.setAction
 _   _  (
     _      polyModifyFace
  __ _   _ _(
 _  _ _ _ _     f, __        ____  _  _  _  //_modified_face
     _  _   _   faceI,      _               // label_of face
_   _ __     _ _own,       __           ___ // owner
__     _____    -1, _      __    _ __   _   //_neighbour
          __ ___flipFaceFlux,_   _          // face flip
  __    _     __newPatchI,   _       _    _ // patch for_face
                false,    _    _    _  __  _// remove from zone
_       _       zoneID,          _      _  _// zone_for face
       _        zoneFlip  _             __  // face flip in_zone
     _   _  )
 __  _ _);
   _   _modifiedFace[faceI] = 1;
    }
 _  else
_   {
       _// Second or more usage of face. Add.
        meshMod.setAction
     _  (
__          polyAddFace
 _ _        (
