Integrals on internal edges

I’m trying to set up the following problem

I’ve built the mesh like this

 border f0(t=0,1){P.x=nodes(2,0)*t + nodes(1,0)*(1-t);P.y=nodes(2,1)*t + nodes(1,1)*(1-t); label=11;};
 border f1(t=0,1){P.x=nodes(0,0)*t + nodes(2,0)*(1-t);P.y=nodes(0,1)*t + nodes(2,1)*(1-t); label=22;};
 border f2(t=0,1){P.x=nodes(1,0)*t + nodes(0,0)*(1-t);P.y=nodes(1,1)*t + nodes(0,1)*(1-t); label=33;};
 
 Th[K] = buildmesh(f0(1) + f1(1) + f2(1));
 Th[K] = trunc(Th[K], abs(u0 -K) < 1e-5, split=2^subMesh, label=00);

So, all my internal edges have label 00. For equation (4.30), since its on the edges that are on the domain boundary, I already have the values as follows

  fespace Ph(calP, Pm);
  varf vlenedge(u,v) = intalledges(calP)(1*v/nTonEdge);
  Ph le;
  le[]= vlenedge(0,Ph);

  //space RTm
  fespace RTm(Th[K], RT);
  
  //edge space
  fespace PPm(Th[K], Pm);
  PPm p, q;

  RTm [sigmaHx, sigmaHy];
  RTm [varphix, varphiy];

 for(int i=0;i<nDoFl0K;i++){
    int ii = locationMatrix(K,i);

    real bLH = lambdaH[][ii];

    sigmaKHx(i) = bLH*le[][Ph(K,i)];
    sigmaKHy(i) = bLH*le[][Ph(K,i)];
}

but I’m having some difficulties with computing only on the internal edges. I’ve tried:

fespace VhKaux(Th[K],Pk);
  VhKaux auxuHhK;
  auxuHhK[] = uHhg(K,:);
  
  matrix mCk;
  fespace vVhK(Th[K], [Pk,Pk]);
  vVhK [vsolx, vsoly] = [dx(auxuHhK), dy(auxuHhK)];
  real[int] vCk;
  varf chk([varphix, varphiy], [q])
     = intalledges(Th[K],00)((varphix*N.x + varphiy*N.y)*q);
      
    mCk = chk(RTm, PPm);
    cout << mCk << "\n";
    
  varf lhK([vsolx, vsoly], [q])
    = intalledges(Th[K],00)(-1*kappa*mean(vsolx)*q);
  
  real[int] vlhK(ndofPPm); 
  vlhK = lhK(0, PPm);
  cout << vlhK << "\n";
  
  set(mCk, solver=sparsesolver);
  sigmaHx[] = mCk^-1*vlhK;

but no success. Can someone help?

One idea might be to define the levelset parameter for int1d.
You could use this to integrate along an internal curve.
https://doc.freefem.org/documentation/finite-element.html#parameters-affecting-solve-and-problem