package BoxTools; /** A:destination; B: source * Modified on Nov 01, 2004 to eliminate the use of DataIndex so that allocation * cost can be saved. **/ template public class Copier{ private final static int SPACE_DIM=Util.SPACE_DIM; private final static int SORT_DIM=Util.SORT_DIM; private BoxLayout local single m_layoutA, m_layoutB; private int m_procID=Ti.thisProc(); private int m_numOfProcs=Ti.numProcs(); private int m_numOfBoxesA; private boolean m_defined; LayoutIterator local m_layoutItrA, m_layoutItrB; boolean m_IsLayoutABSame; //DataIndex local [] local [] local m_ABRelation; int [] local [] local m_ABRelation; T local boxedDataA_l, boxedDataB_l; T boxedDataB; RectDomain boxA,boxB; //DataIndex local DI; public Copier(BoxLayout local single a_layoutA, BoxLayout local single a_layoutB){ PrivateRegion local region =new PrivateRegion(); //DataIndex local [] local buffer; int [] local buffer; m_layoutA=a_layoutA;m_layoutB=a_layoutB; if (!m_layoutA.m_disjointed || !m_layoutB.m_disjointed){ Util.printErrMsg("Copier::Copier(): at least one of the BoxLayouts is not disjointed!"); m_defined=false; return; } m_layoutItrA=new LayoutIterator(m_layoutA); m_layoutItrB=new LayoutIterator(m_layoutB); m_numOfBoxesA=m_layoutA.numBoxesAt(m_procID); m_IsLayoutABSame=(m_layoutA==m_layoutB); m_defined=true; if (!m_IsLayoutABSame){ m_ABRelation=new int [m_numOfBoxesA] local [] local; buffer=new(region) int [m_layoutB.size()] local; boolean sorted=m_layoutB.m_sorted; int i,j,k; int gIdx, lIdx; for (i=0;i local single a_BLDA, template BoxLayoutData local single a_BLDB){ if ((boolean single)(m_layoutA!=a_BLDA.boxLayout() || m_layoutB!=a_BLDB.boxLayout() || !m_defined)) Util.printErrMsg("Copier::copy(): invalid BoxLayoutData or Copier"); else{ Ti.barrier(); m_layoutItrA.reset(); int i,j,k; int gIdxB,lIdxB,procIDB; //boolean IsLayoutABSame=(m_layoutA==m_layoutB); for (i=0;i