Пример #1
0
void CollectionMgr::submitVelocities(int seq, int zero, FullAtomList &a)
{
  int numAtoms = a.size();
  AtomIDList aid(numAtoms);
  PositionList d(numAtoms);
  for ( int i=0; i<numAtoms; ++i ) {
    aid[i] = a[i].id;
    if ( zero ) d[i] = 0.;
    else d[i] = a[i].velocity;
  }
  CollectVectorInstance *c;
  if ( ( c = velocities.submitData(seq,aid,d) ) )
  {
    int aid_size = c->aid.size();
    int data_size = c->data.size();
    CollectVectorMsg *msg = new (aid_size, data_size, 0, 0) CollectVectorMsg;
    msg->seq = c->seq;
    msg->aid_size = aid_size;
    msg->data_size = data_size;
    msg->fdata_size = 0;
    memcpy(msg->aid,c->aid.begin(),aid_size*sizeof(AtomID));
    memcpy(msg->data,c->data.begin(),data_size*sizeof(Vector));
    CProxy_CollectionMaster cm(master);
    cm.receiveVelocities(msg);
    c->free();
  }
}
DWORD WINAPI  _threadShowWaitDLG(LPVOID lp)
{
	ThreadCacheDC::CreateThreadCacheDC();

	if (NULL == g_pSkin)
		new CSkinManager();

	g_pSkin->RefreshProgressSkin();
	
	MsgData *pMD = (MsgData*)lp;

	if(pMD == NULL)
		return 0;

	HWND hMainFrame = FindWindow(_T("MONEYHUB_MAINFRAME"), NULL);
	if(pMD->type == 1)
	{
		CCoolMessageBox dlg(pMD->info.c_str(), L"²Æ½ð»ã", pMD->wtype);
		pMD->res = dlg.DoModal();
	}
	else
	{
		USES_CONVERSION;
		wstring waid = pMD->info.substr(0, 4);
		wstring msg = pMD->info.substr(4);
		string aid( W2A(waid.c_str()) );

		CSaveFavProgressDlg dlg(aid, msg);
		int res = dlg.DoModal();
	}

	ThreadCacheDC::DestroyThreadCacheDC();
	return 1;
}
Пример #3
0
void CollectionMgr::submitPositions(int seq, FullAtomList &a,
				Lattice l, int prec)
{  
  int numAtoms = a.size();
  AtomIDList aid(numAtoms);
  PositionList d(numAtoms);
  for ( int i=0; i<numAtoms; ++i ) {
    aid[i] = a[i].id;
    d[i] = l.reverse_transform(a[i].position,a[i].transform);
  }
  CollectVectorInstance *c;
  if ( ( c = positions.submitData(seq,aid,d,prec) ) )
  {
    int aid_size = c->aid.size();
    int data_size = c->data.size();
    int fdata_size = c->fdata.size();
    CollectVectorMsg *msg
      = new (aid_size, data_size, fdata_size,0) CollectVectorMsg;
    msg->seq = c->seq;
    msg->aid_size = aid_size;
    msg->data_size = data_size;
    msg->fdata_size = fdata_size;
    memcpy(msg->aid,c->aid.begin(),aid_size*sizeof(AtomID));
    memcpy(msg->data,c->data.begin(),data_size*sizeof(Vector));
    memcpy(msg->fdata,c->fdata.begin(),fdata_size*sizeof(FloatVector));
    CProxy_CollectionMaster cm(master);
    cm.receivePositions(msg);
    c->free();
  }
}
Пример #4
0
void CollectionMgr::submitForces(int seq, FullAtomList &a, int maxForceUsed, ForceList *f)
{
  int numAtoms = a.size();
  AtomIDList aid(numAtoms);
  ResizeArray<int> oRank(numAtoms);
  ForceList d(numAtoms);
  for ( int i=0; i<numAtoms; ++i ) {
    aid[i] = a[i].id;
    oRank[i] = a[i].outputRank;
    d[i] = 0.;
  }
  for ( int j=0; j<=maxForceUsed; ++j ) {
    Force *fptr = f[j].begin();
    for ( int i=0; i<numAtoms; ++i ) {
      d[i] += fptr[i];
    }
  }
  if ( Node::Object()->simParameters->fixedAtomsOn && !Node::Object()->simParameters->fixedAtomsForceOutput) {
    for ( int i=0; i<numAtoms; ++i ) {
      if ( a[i].atomFixed ) d[i] = 0.;
    }
  }
  CollectVectorInstance *c;
  if ( ( c = forces.submitData(seq,aid,oRank,d) ) )
  {
      CProxy_ParallelIOMgr io(CkpvAccess(BOCclass_group).ioMgr);
      ParallelIOMgr *ioMgr = io.ckLocalBranch();

      //construct per output proc atoms list
      AtomIDList *perOList = new AtomIDList[ioMgr->numOutputProcs];
      for(int i=0; i<c->aid.size(); i++){
          perOList[c->outRank[i]].add(i);
      }    
      CollectVectorVarMsg::DataStatus vstatus = CollectVectorVarMsg::VectorValid;
      //send msg to output proc if there's one    
        for(int i=0; i<ioMgr->numOutputProcs; i++){
            int numAtoms = perOList[i].size();
            if(!numAtoms) continue;
            CollectVectorVarMsg *msg;            
            msg = new(numAtoms, numAtoms, 0, 0)CollectVectorVarMsg;
            msg->seq = c->seq;
            msg->size = numAtoms;
            msg->status = vstatus;
            for(int j=0; j<numAtoms; j++){
                int lIdx = perOList[i][j];
                msg->aid[j] = c->aid[lIdx];
                msg->data[j] = c->data[lIdx];
            }
            io[ioMgr->outputProcArray[i]].receiveForces(msg);            
        }
        c->free();
        delete [] perOList;         
  }
}
Пример #5
0
void CollectionMgr::submitVelocities(int seq, int zero, FullAtomList &a)
{
  int numAtoms = a.size();
  AtomIDList aid(numAtoms);
  ResizeArray<int> oRank(numAtoms);
  PositionList d(numAtoms);
  for ( int i=0; i<numAtoms; ++i ) {
    aid[i] = a[i].id;
    oRank[i] = a[i].outputRank;
    if ( zero ) d[i] = 0.;
    else d[i] = a[i].velocity;
  }
  CollectVectorInstance *c;
  if ( ( c = velocities.submitData(seq,aid,oRank,d) ) )
  {
      CProxy_ParallelIOMgr io(CkpvAccess(BOCclass_group).ioMgr);
      ParallelIOMgr *ioMgr = io.ckLocalBranch();

      //construct per output proc atoms list
      AtomIDList *perOList = new AtomIDList[ioMgr->numOutputProcs];
      for(int i=0; i<c->aid.size(); i++){
          perOList[c->outRank[i]].add(i);
      }    
      CollectVectorVarMsg::DataStatus vstatus = CollectVectorVarMsg::VectorValid;
      //send msg to output proc if there's one    
        for(int i=0; i<ioMgr->numOutputProcs; i++){
            int numAtoms = perOList[i].size();
            if(!numAtoms) continue;
            CollectVectorVarMsg *msg;            
            msg = new(numAtoms, numAtoms, 0, 0)CollectVectorVarMsg;
            msg->seq = c->seq;
            msg->size = numAtoms;
            msg->status = vstatus;
            for(int j=0; j<numAtoms; j++){
                int lIdx = perOList[i][j];
                msg->aid[j] = c->aid[lIdx];
                msg->data[j] = c->data[lIdx];
            }
            io[ioMgr->outputProcArray[i]].receiveVelocities(msg);            
        }
        c->free();
        delete [] perOList;         
  }
}
Пример #6
0
void CollectionMgr::submitForces(int seq, FullAtomList &a, int maxForceUsed, ForceList *f)
{
  int numAtoms = a.size();
  AtomIDList aid(numAtoms);
  ForceList d(numAtoms);
  for ( int i=0; i<numAtoms; ++i ) {
    aid[i] = a[i].id;
    d[i] = 0.;
  }
  for ( int j=0; j<=maxForceUsed; ++j ) {
    Force *fptr = f[j].begin();
    for ( int i=0; i<numAtoms; ++i ) {
      d[i] += fptr[i];
    }
  }
  if ( Node::Object()->simParameters->fixedAtomsOn && !Node::Object()->simParameters->fixedAtomsForceOutput) {
    for ( int i=0; i<numAtoms; ++i ) {
      if ( a[i].atomFixed ) d[i] = 0.;
    }
  }
  CollectVectorInstance *c;
  if ( ( c = forces.submitData(seq,aid,d) ) )
  {
    int aid_size = c->aid.size();
    int data_size = c->data.size();
    CollectVectorMsg *msg = new (aid_size, data_size, 0, 0) CollectVectorMsg;
    msg->seq = c->seq;
    msg->aid_size = aid_size;
    msg->data_size = data_size;
    msg->fdata_size = 0;
    memcpy(msg->aid,c->aid.begin(),aid_size*sizeof(AtomID));
    memcpy(msg->data,c->data.begin(),data_size*sizeof(Vector));
    CProxy_CollectionMaster cm(master);
    cm.receiveForces(msg);
    c->free();
  }
}
Пример #7
0
void CollectionMgr::submitPositions(int seq, FullAtomList &a,
				Lattice l, int prec)
{
  int numAtoms = a.size();
  AtomIDList aid(numAtoms);
  ResizeArray<int> oRank(numAtoms);
  PositionList d(numAtoms);
  for ( int i=0; i<numAtoms; ++i ) {
    aid[i] = a[i].id;
    oRank[i] = a[i].outputRank;
    d[i] = l.reverse_transform(a[i].position,a[i].transform);
  }
  CollectVectorInstance *c;
  if ( ( c = positions.submitData(seq,aid,oRank,d,prec) ) )
  {    
    CProxy_ParallelIOMgr io(CkpvAccess(BOCclass_group).ioMgr);
    ParallelIOMgr *ioMgr = io.ckLocalBranch();

    //construct per output proc atoms list
    AtomIDList *perOList = new AtomIDList[ioMgr->numOutputProcs];
    for(int i=0; i<c->aid.size(); i++){
        perOList[c->outRank[i]].add(i);
    }    
    CollectVectorVarMsg::DataStatus vstatus;
    if(c->data.size()==0){
        vstatus = CollectVectorVarMsg::FloatVectorValid;
    }else if(c->fdata.size()==0){
        vstatus = CollectVectorVarMsg::VectorValid;
    }else{
        vstatus = CollectVectorVarMsg::BothValid;
    }
    //send msg to output proc if there's one    
    for(int i=0; i<ioMgr->numOutputProcs; i++){
        int numAtoms = perOList[i].size();
        if(!numAtoms) continue;
        CollectVectorVarMsg *msg;
        if( vstatus == CollectVectorVarMsg::VectorValid){
            msg = new(numAtoms, numAtoms, 0, 0)CollectVectorVarMsg;
            for(int j=0; j<numAtoms; j++){
                int lIdx = perOList[i][j];
                msg->aid[j] = c->aid[lIdx];
                msg->data[j] = c->data[lIdx];
            }
        }else if(vstatus == CollectVectorVarMsg::FloatVectorValid){
            msg = new(numAtoms, 0, numAtoms, 0)CollectVectorVarMsg;
            for(int j=0; j<numAtoms; j++){
                int lIdx = perOList[i][j];
                msg->aid[j] = c->aid[lIdx];
                msg->fdata[j] = c->fdata[lIdx];
            }
        }else{
            msg = new(numAtoms, numAtoms, numAtoms, 0)CollectVectorVarMsg;
            for(int j=0; j<numAtoms; j++){
                int lIdx = perOList[i][j];
                msg->aid[j] = c->aid[lIdx];
                msg->data[j] = c->data[lIdx];
                msg->fdata[j] = c->fdata[lIdx];
            }
        }
        msg->seq = c->seq;
        msg->size = numAtoms;
        msg->status = vstatus;
        io[ioMgr->outputProcArray[i]].receivePositions(msg);
    }
    c->free();
    delete [] perOList;
  }
}
Пример #8
0
const char* shortLoc(int id) {
  BaseAST* ast = aid(id);
  return ast ? shortLoc(ast) : aidError("shortLoc", id);
}
Пример #9
0
const char* stringLoc(int id) {
  BaseAST* ast = aid(id);
  return ast ? stringLoc(ast) : aidError("stringLoc", id);
}
Пример #10
0
void iprint_view(int id) {
  nprint_view(aid(id));
}
Пример #11
0
void nprint_view(int id) {
  BaseAST* ast = aid(id);
  if (ast) nprint_view(ast); else printAidError("nprint_view", id);
}
Пример #12
0
void list_view(int id) {
  BaseAST* ast = aid(id);
  if (ast) list_view(ast); else printAidError("list_view", id);
}
Пример #13
0
void viewFlags(int id) {
  BaseAST* ast = aid(id);
  if (ast) viewFlags(ast); else printAidError("viewFlags", id);
}
void
printNode(int id) {
  printNode(aid(id));
}