anchor.diff:    allocate(mapNode(nNode))
     call MPI_recv(mapNode,nNode,MPI_integer,0,pidMPI,MPI_comm_world,statMPI,errMPI)
     call MPI_recv(Node,nNode,typeNodeMPI,0,pidMPI,MPI_comm_world,statMPI,errMPI)
  -  
     ! receive points
     call MPI_recv(nPoint,1,MPI_integer,0,pidMPI,MPI_comm_world,statMPI,errMPI)
     allocate(Point(nPoint))
     allocate(mapPoint(nPoint))
     call MPI_recv(mapPoint,nPoint,MPI_integer,0,pidMPI,MPI_comm_world,statMPI,errMPI)
     call MPI_recv(Point,nPoint,typePointMPI,0,pidMPI,MPI_comm_world,statMPI,errMPI)
  -  
     ! receive lines
     call MPI_recv(nLine,1,MPI_integer,0,pidMPI,MPI_comm_world,statMPI,errMPI)
     allocate(Line(nLine))
     allocate(mapLine(nLine))
     call MPI_recv(mapLine,nLine,MPI_integer,0,pidMPI,MPI_comm_world,statMPI,errMPI)
     call MPI_recv(Line,nLine,typeLineMPI,0,pidMPI,MPI_comm_world,statMPI,errMPI)
  -  
     ! receive triangles
     call MPI_recv(nTri,1,MPI_integer,0,pidMPI,MPI_comm_world,statMPI,errMPI)
     allocate(Tri(nTri))
     allocate(mapTri(nTri))
     call MPI_recv(mapTri,nTri,MPI_integer,0,pidMPI,MPI_comm_world,statMPI,errMPI)
     call MPI_recv(Tri,nTri,typeTriMPI,0,pidMPI,MPI_comm_world,statMPI,errMPI)
  -  
     ! receive quadrilaterals
     call MPI_recv(nQuad,1,MPI_integer,0,pidMPI,MPI_comm_world,statMPI,errMPI)
     allocate(Quad(nQuad))
     allocate(mapQuad(nQuad))
     call MPI_recv(mapQuad,nQuad,MPI_integer,0,pidMPI,MPI_comm_world,statMPI,errMPI)
     call MPI_recv(Quad,nQuad,typeQuadMPI,0,pidMPI,MPI_comm_world,statMPI,errMPI)
  -  
     ! receive tetrahedrons
     call MPI_recv(nTet,1,MPI_integer,0,pidMPI,MPI_comm_world,statMPI,errMPI)
     allocate(Tet(nTet))
     allocate(mapTet(nTet))
     call MPI_recv(mapTet,nTet,MPI_integer,0,pidMPI,MPI_comm_world,statMPI,errMPI)
     call MPI_recv(Tet,nTet,typeTetMPI,0,pidMPI,MPI_comm_world,statMPI,errMPI)
  -  
     ! receive hexahedrons
     call MPI_recv(nHex,1,MPI_integer,0,pidMPI,MPI_comm_world,statMPI,errMPI)
     allocate(Hex(nHex))
     allocate(mapHex(nHex))
     call MPI_recv(mapHex,nHex,MPI_integer,0,pidMPI,MPI_comm_world,statMPI,errMPI)
     call MPI_recv(Hex,nHex,typeHexMPI,0,pidMPI,MPI_comm_world,statMPI,errMPI)
  -  
     ! receive facets
     call MPI_recv(nFacet,1,MPI_integer,0,pidMPI,MPI_comm_world,statMPI,errMPI)
     allocate(Facet(nFacet))
     allocate(mapFacet(nFacet))
     call MPI_recv(mapFacet,nFacet,MPI_integer,0,pidMPI,MPI_comm_world,statMPI,errMPI)
     call MPI_recv(Facet,nFacet,typeFacetMPI,0,pidMPI,MPI_comm_world,statMPI,errMPI)
  -  
     ! receive elements
     call MPI_recv(nEle,1,MPI_integer,0,pidMPI,MPI_comm_world,statMPI,errMPI)
     allocate(Ele(nEle))
  
positive.code:   end do
    nkNode=count(gmapNode(:)>0)
    allocate(buffNode(nkNode))
    allocate(smapNode(nkNode))
    do i=1,nNode
      if(gmapNode(i)>0)then
        smapNode(gmapNode(i))=i
      end if
    end do
    buffNode(:)=Node(smapNode)
    ! copy points
    gmapPoint(:)=0
    j=0
  
negative.code:   ! copy elements
    nkEle=count(Ele(:)%Prt==k)
    allocate(buffEle(nkEle))
    allocate(mapEle(nkEle))
    j=1
    do i=1,nEle
      if(Ele(i)%Prt==k)then
        mapEle(j)=i
        gmapEle(i)=j
        j=j+1
      end if
    end do
    buffEle(:)=Ele(mapEle(:))
    ! copy facets
    nkFacet=sum([(count(buffEle(i)%Neib(:)<0),i=1,nkEle)])
    allocate(buffFacet(nkFacet))
    allocate(mapFacet(nkFacet))
    l=1
    do i=1,nkEle
      do j=1,size(buffEle(i)%Neib)
        if(buffEle(i)%Neib(j)<0)then
          mapFacet(l)=-buffEle(i)%Neib(j)
          gmapFacet(-buffEle(i)%Neib(j))=l
          l=l+1
        end if
      end do
    end do
    buffFacet(:)=Facet(mapFacet)
    ! copy tetrahedrons
    nkTet=count(buffEle(:)%ShapeType==4)
    allocate(buffTet(nkTet))
    allocate(mapTet(nkTet))
    j=1
    do i=1,nkEle
      if(buffEle(i)%ShapeType==4)then
        mapTet(j)=buffEle(i)%ShapeInd
        gmapTet(buffEle(i)%ShapeInd)=j
        j=j+1
      end if
    end do
    buffTet(:)=Tet(mapTet)
    ! copy hexahedrons
    nkHex=count(buffEle(:)%ShapeType==5)
    allocate(buffHex(nkHex))
    allocate(mapHex(nkHex))
    j=1
    do i=1,nkEle
      if(buffEle(i)%ShapeType==5)then
        mapHex(j)=buffEle(i)%ShapeInd
        gmapHex(buffEle(i)%ShapeInd)=j
        j=j+1
      end if
    end do
    buffHex(:)=Hex(mapHex)
    ! copy triangles
    nkTri=count(buffFacet(:)%ShapeType==2)
    allocate(buffTri(nkTri))
    allocate(mapTri(nkTri))
    j=1
    do i=1,nkFacet
      if(buffFacet(i)%ShapeType==2)then
        mapTri(j)=buffFacet(i)%ShapeInd
        gmapTri(buffFacet(i)%ShapeInd)=j
        j=j+1
      end if
    end do
    buffTri(:)=Tri(mapTri)
    ! copy quadrilaterals
    nkQuad=count(buffFacet(:)%ShapeType==3)
    allocate(buffQuad(nkQuad))
    allocate(mapQuad(nkQuad))
    j=1
    do i=1,nkFacet
      if(buffFacet(i)%ShapeType==3)then
        mapQuad(j)=buffFacet(i)%ShapeInd
        gmapQuad(buffFacet(i)%ShapeInd)=j
        j=j+1
      end if
    end do
    buffQuad(:)=Quad(mapQuad)
    ! copy nodes
    gmapNode(:)=0
    l=0
  