Exemplo n.º 1
0
void BPIdxMarket::processMsgIndex(const idx_indices_t& pr)
{
    //update indices item
    string key = pr.idxCode;
    bo_indexsum_t* pIndices = findIndices(key);
    pIndices->idxCode     = pr.idxCode;
    pIndices->idxVal        = pr.idxVal;
    pIndices->idxHigh       = pr.idxHigh;
    pIndices->idxLow        = pr.idxLow;
    pIndices->idxOpen       = pr.idxOpen;
    if(pr.prevIdx > 0.0)
        pIndices->prevIdxVal    = pr.prevIdx;
    //pIndices->idxVol;
    //pIndices->idxFreq;
    pIndices->exchMktVal    = pr.exchMktVal;
    pIndices->exchBaseVal   = pr.exchBaseVal;
    
    bo_indexsum_t* pIndicesTrade = m_pIndicesList->getInstance();
    pIndicesTrade->assign(pIndices);
    touchIndices(pIndicesTrade, pr.idx_time);
    
    
    //update market summary
    if(pr.idxCode.compare(DEFAULT_SECTOR) == 0){
        m_pMktSum->pCompositeIdx = pIndices;
        touchMarketSum(m_pMktSum, pr.idx_time);
    }
}
void Foam::mapDistributePolyMesh::distributePatchIndices(labelList& lst) const
{
    // Construct boolList from selected elements
    boolList isSelected
    (
        createWithValues<boolList>
        (
            oldPatchStarts().size(),    // nOldPatches
            false,
            lst,
            true
        )
    );

    // Distribute
    distributePatchData(isSelected);

    // Collect selected elements
    lst = findIndices(isSelected, true);
}
void Foam::mapDistributePolyMesh::distributeCellIndices(labelList& lst) const
{
    // Construct boolList from selected elements
    boolList isSelected
    (
        createWithValues<boolList>
        (
            nOldCells(),
            false,
            lst,
            true
        )
    );

    // Distribute
    distributeCellData(isSelected);

    // Collect selected elements
    lst = findIndices(isSelected, true);
}
Exemplo n.º 4
0
FVectorCache::FVectorCache() {
  eps_chares_x = 7;
  eps_chares_y = 7;
  totalSize = 0;
  GWBSE *gwbse = GWBSE::get();
  L = gwbse->gw_parallel.L;
  int total_eps_chares = eps_chares_x*eps_chares_y;

  my_chare_count = total_eps_chares/CkNumNodes();

  my_chare_start = CkMyNode()*my_chare_count;
  int remaining = total_eps_chares%CkNumNodes();

  if(CkMyNode()>0)
    my_chare_start += remaining;

  if(CkMyNode()==0)
    my_chare_count += remaining;

  my_eps_chare_indices_x = new int[my_chare_count];
  my_eps_chare_indices_y = new int[my_chare_count];

  findIndices();
  int count = 0;
  for(int i=eps_start_chare_x;i<=eps_end_chare_x;i++){
    int j = 0;
    if(i==eps_start_chare_x)
      j = eps_start_chare_y;
    int j_end = eps_chares_y-1;
    if(i==eps_end_chare_x)
      j_end = eps_end_chare_y;
    while(j<=j_end){
      my_eps_chare_indices_x[count] = i;
      my_eps_chare_indices_y[count++] = j;
      j++;
    }
  }

  ndata = gwbse->gw_parallel.n_elems;
  data_size_x = ndata/eps_chares_x;
  if(ndata%eps_chares_x > 0)
    data_size_x += 2;
  data_size_y = ndata/eps_chares_y;
    if(ndata%eps_chares_y > 0)
      data_size_y += 2;
  data_offset_x = new int[my_chare_count];
  data_offset_y = new int[my_chare_count];

  for(int i=0;i<my_chare_count;i++){
    data_offset_x[i] = my_eps_chare_indices_x[i]*data_size_x;
    data_offset_y[i] = my_eps_chare_indices_y[i]*data_size_y;
  }

  int size_x = data_size_x;
  int size_y = data_size_y;
  local_offset =  new int[my_chare_count*2];
  global_offset = new int[my_chare_count*2];
  for(int i=0;i<my_chare_count;i++){
    global_offset[2*i] = data_offset_x[i];//totalSize;
    local_offset[2*i] = totalSize;
    totalSize += size_x;

    global_offset[2*i+1] = data_offset_y[i];//totalSize;
    local_offset[2*i+1] = totalSize;
    totalSize += size_y;
  }

  fs = new complex[NSIZE*L*totalSize];

  contribute(CkCallback(CkReductionTarget(Controller,fCacheReady), controller_proxy));
}