//------------------------------------------------------------
// $Id: PRC_PErecv.cc,v 1.1.1.1 1999/11/25 06:26:11 yamauchi Exp $ 
//------------------------------------------------------------
//	PRC_PErecv.cc 
//	Proximity Clouds method
// 
//	(C) Copyright 1998 Mayumi TOKUNAGA	徳永 真由美
//	(C) Copyright 1998 Hitoshi YAMAUCHI	山内 斉
//------------------------------------------------------------
#include "PE.h"
#include "mpi2communication.h"

#if (defined USE_MPI) || (defined IBMSP2)
#				// OK
#else
# error "This file is for mpi or mpl version of (Mpi)2."
#endif

void PEClass::
receivePRCSkipMap(void)
{
    int size[3];
    size[0] = size[1] = size[2] = this->mSpcParam.getSubDivNum();
    const int totalSize = size[0] * size[1] * size[2];
    assert(totalSize > 0);	// 既に SpcParam は受信済みのはず
        OBJINSPC_IMPLEMENT_TYPE *pDatArray = 
	new OBJINSPC_IMPLEMENT_TYPE [totalSize];
    commMpi2_BroadPRCSkipMap(sizeof(OBJINSPC_IMPLEMENT_TYPE) * totalSize, 
			   pDatArray);     

    // Map 領域作成と初期化
    this->mPRCUnit.mObjInSpcMap.initBySizeWithBaseZero(size); 

    // 受信内容のコピー
    for(int i = 0; i < this->mPRCUnit.mObjInSpcMap.getTotalSize(); i++)
    {
	PRC_skipMapClass oeias(pDatArray[i]);
	this->mPRCUnit.mObjInSpcMap.setAsOneDimArray(i, oeias);
    }
}

