Changeset 567 for XIOS/trunk/src/node/field.cpp
- Timestamp:
- 03/10/15 10:49:02 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/field.cpp
- Property svn:executable set to *
r562 r567 152 152 list< CArray<double,1>* > list_data; 153 153 154 for (it = grid->storeIndex_toSrv.begin(); it != grid->storeIndex_toSrv.end(); it++) 155 { 156 int rank = (*it).first; 157 CArray<int,1>& index = *(it->second); 158 CArray<double,1> data_tmp(index.numElements()); 159 for (int n = 0; n < data_tmp.numElements(); n++) data_tmp(n) = data(index(n)); 160 list_msg.push_back(shared_ptr<CMessage>(new CMessage)); 161 list_data.push_back(new CArray<double,1>(data_tmp)); 162 *list_msg.back() << getId() << *list_data.back(); 163 event.push(rank,grid->nbSenders[rank],*list_msg.back()); 164 } 165 client->sendEvent(event); 154 if (!grid->doGridHaveDataDistributed()) 155 { 156 if (0 == client->getClientRank()) 157 { 158 for(it=grid->storeIndex_toSrv.begin();it!=grid->storeIndex_toSrv.end();it++) 159 { 160 int rank=(*it).first ; 161 CArray<int,1>& index = *(it->second) ; 162 CArray<double,1> data_tmp(index.numElements()) ; 163 for(int n=0;n<data_tmp.numElements();n++) data_tmp(n)=data(index(n)) ; 164 165 list_msg.push_back(shared_ptr<CMessage>(new CMessage)) ; 166 list_data.push_back(new CArray<double,1>(data_tmp)) ; 167 *list_msg.back()<<getId()<<*list_data.back() ; 168 event.push(rank,1,*list_msg.back()) ; 169 } 170 client->sendEvent(event) ; 171 } else client->sendEvent(event); 172 } 173 else 174 { 175 for(it=grid->storeIndex_toSrv.begin();it!=grid->storeIndex_toSrv.end();it++) 176 { 177 int rank=(*it).first ; 178 CArray<int,1>& index = *(it->second) ; 179 CArray<double,1> data_tmp(index.numElements()) ; 180 for(int n=0;n<data_tmp.numElements();n++) data_tmp(n)=data(index(n)) ; 181 list_msg.push_back(shared_ptr<CMessage>(new CMessage)) ; 182 list_data.push_back(new CArray<double,1>(data_tmp)) ; 183 *list_msg.back()<<getId()<<*list_data.back() ; 184 event.push(rank,grid->nbSenders[rank],*list_msg.back()) ; 185 } 186 client->sendEvent(event) ; 187 } 166 188 167 189 for (list< CArray<double,1>* >::iterator it = list_data.begin(); it != list_data.end(); it++) delete *it; … … 189 211 void CField::recvUpdateData(vector<int>& ranks, vector<CBufferIn*>& buffers) 190 212 { 191 192 213 if (data_srv.empty()) 193 214 { 194 // for (map<int, CArray<int, 1>* >::iterator it = grid->out_i_fromClient.begin(); it != grid->out_i_fromClient.end(); it++)195 215 for (map<int, CArray<size_t, 1>* >::iterator it = grid->outIndexFromClient.begin(); it != grid->outIndexFromClient.end(); ++it) 196 216 { … … 234 254 { 235 255 if (!getRelFile()->allDomainEmpty) 236 if ( !grid->domain->isEmpty() || getRelFile()->type == CFile::type_attr::one_file)256 if (grid->doGridHaveDataToWrite() || getRelFile()->type == CFile::type_attr::one_file) // if (! grid->domain->isEmpty() || getRelFile()->type == CFile::type_attr::one_file) 237 257 { 238 258 getRelFile()->checkFile(); … … 553 573 } 554 574 555 // if (!grid_ref.isEmpty())556 // {557 // domain = grid->domain;558 // axis = grid->axis;559 // }560 561 // CType<string> goodDomain;562 // CType<string> goodAxis;563 // if (!grid_ref.isEmpty())564 // {565 // if (!grid->domain_ref.isEmpty()) goodDomain = grid->domain_ref;566 // if (!grid->axis_ref.isEmpty()) goodAxis = grid->axis_ref;567 // }568 // if (!domain_ref.isEmpty()) goodDomain = domain_ref;569 // if (!axis_ref.isEmpty()) goodAxis = axis_ref;570 571 // CArray<std::string,1> domListTmp = grid->domainList.getValue();572 // CArray<std::string,1> axisListTmp = grid->axisList.getValue();573 575 574 576 if (domList.empty() && axisList.empty()) … … 576 578 this->grid = CGrid::createGrid(vecDom, vecAxis); 577 579 } 578 579 // std::string goodDomain = domListTmp[0];580 // std::string goodAxis = axisListTmp[0];581 582 // if (goodDomain.isEmpty())583 // if (goodDomain.empty())584 // {585 // ERROR("CField::solveGridReference(void)", << "The horizontal domain for this field is not defined");586 // }587 // else588 // {589 // if (CDomain::has(goodDomain)) domain = CDomain::get(goodDomain);590 // else ERROR("CField::solveGridReference(void)",<< "Reference to the domain \'"591 // << goodDomain << "\' is wrong");592 //// << goodDomain.get() << "\' is wrong");593 // }594 //595 //// if (!goodAxis.isEmpty())596 // if (!goodAxis.empty())597 // {598 // if (CAxis::has(goodAxis)) axis = CAxis::get(goodAxis);599 // else ERROR("CField::solveGridReference(void)", << "Reference to the axis \'"600 // << goodAxis <<"\' is wrong");601 // << goodAxis.get() <<"\' is wrong");602 // }603 604 // bool nothingToDo = false;605 //606 // if (!grid_ref.isEmpty())607 // {608 // if (!grid->domain_ref.isEmpty() && goodDomain.get() == grid->domain_ref.get())609 // if (goodAxis.isEmpty()) nothingToDo = true;610 // else if (!grid->axis_ref.isEmpty())611 // if (grid->axis_ref.get() == goodAxis.get()) nothingToDo = true;612 // }613 //614 // nothingToDo = true;615 // if (!nothingToDo)616 // {617 // if (!goodAxis.isEmpty())618 // {619 // this->grid = CGrid::createGrid(domain, axis);620 // this->grid_ref.setValue(this->grid->getId());621 // }622 // else623 // {624 // this->grid = CGrid::createGrid(domain);625 // this->grid_ref.setValue(this->grid->getId());626 // }627 // }628 629 // grid->solveReference();630 // grid->solveDomainAxisRef();631 // grid->checkMaskIndex();632 580 } 633 581 … … 682 630 grid->outputField(it->first,*it->second, fieldOut.dataFirst()); 683 631 } 684 685 // grid->outputField(it->first,*it->second, fieldOut.);686 632 } 687 633 … … 689 635 { 690 636 map<int, CArray<double,1>* >::iterator it; 637 for(it=data_srv.begin();it!=data_srv.end();it++) 638 { 639 grid->outputField(it->first,*it->second, fieldOut.dataFirst()) ; 640 } 641 } 642 643 void CField::outputField(CArray<double,1>& fieldOut) 644 { 645 map<int, CArray<double,1>* >::iterator it; 691 646 692 647 for (it = data_srv.begin(); it != data_srv.end(); it++) 693 648 { 694 grid->outputField(it->first, *it->second, fieldOut);649 grid->outputField(it->first,*it->second, fieldOut.dataFirst()) ; 695 650 } 696 651 } … … 844 799 \return pair of Domain and Axis id 845 800 */ 846 const std::pair<StdString,StdString>& CField::getDomainAxisIds()847 {848 CGrid* cgPtr = getRelGrid();849 if (NULL != cgPtr)850 {851 if (NULL != cgPtr->getRelDomain()) domAxisIds_.first = cgPtr->getRelDomain()->getId();852 if (NULL != cgPtr->getRelAxis()) domAxisIds_.second = cgPtr->getRelAxis()->getId();853 }854 855 return domAxisIds_;856 }801 // const std::pair<StdString,StdString>& CField::getDomainAxisIds() 802 // { 803 // CGrid* cgPtr = getRelGrid(); 804 // if (NULL != cgPtr) 805 // { 806 // if (NULL != cgPtr->getRelDomain()) domAxisIds_.first = cgPtr->getRelDomain()->getId(); 807 // if (NULL != cgPtr->getRelAxis()) domAxisIds_.second = cgPtr->getRelAxis()->getId(); 808 // } 809 // 810 // return (domAxisIds_); 811 // } 857 812 858 813 CVariable* CField::addVariable(const string& id)
Note: See TracChangeset
for help on using the changeset viewer.