Changeset 1930 for XIOS/dev/dev_ym/XIOS_COUPLING/src/node/scalar.cpp
- Timestamp:
- 09/10/20 13:51:02 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/scalar.cpp
r1875 r1930 7 7 #include "xios_spl.hpp" 8 8 #include "type.hpp" 9 #include "context.hpp" 9 10 10 11 namespace xios { … … 231 232 } 232 233 234 ////////////////////////////////////////////////////////////////////////////////////// 235 // this part is related to distribution, element definition, views and connectors // 236 ////////////////////////////////////////////////////////////////////////////////////// 237 238 void CScalar::initializeLocalElement(void) 239 { 240 // after checkAttribute index of size n 241 int rank = CContext::getCurrent()->getIntraCommRank() ; 242 243 CArray<size_t,1> ind(1) ; 244 ind(0)=0 ; 245 246 localElement_ = new CLocalElement(rank, 1, ind) ; 247 } 248 249 void CScalar::addFullView(void) 250 { 251 CArray<int,1> index(1) ; 252 for(int i=0; i<1 ; i++) index(0)=0 ; 253 localElement_ -> addView(CElementView::FULL, index) ; 254 } 255 256 void CScalar::addWorkflowView(void) 257 { 258 CArray<int,1> index(1) ; 259 for(int i=0; i<1 ; i++) index(0)=0 ; 260 localElement_ -> addView(CElementView::WORKFLOW, index) ; 261 } 262 263 void CScalar::addModelView(void) 264 { 265 CArray<int,1> index(1) ; 266 for(int i=0; i<1 ; i++) index(0)=0 ; 267 localElement_->addView(CElementView::MODEL, index) ; 268 } 269 270 void CScalar::computeModelToWorkflowConnector(void) 271 { 272 CLocalView* srcView=getLocalView(CElementView::MODEL) ; 273 CLocalView* dstView=getLocalView(CElementView::WORKFLOW) ; 274 modelToWorkflowConnector_ = new CLocalConnector(srcView, dstView); 275 modelToWorkflowConnector_->computeConnector() ; 276 } 277 278 279 void CScalar::computeRemoteElement(CContextClient* client, EDistributionType type) 280 { 281 CContext* context = CContext::getCurrent(); 282 map<int, CArray<size_t,1>> globalIndex ; 283 284 int nbServer = client->serverSize; 285 size_t nglo=1 ; 286 CArray<size_t,1> indGlo ; 287 for(size_t i=0;i<nglo;i++) indGlo(i) = i ; 288 for (auto& rankServer : client->getRanksServerLeader()) globalIndex[rankServer] = indGlo ; 289 290 remoteElement_[client] = new CDistributedElement(nglo, globalIndex) ; 291 remoteElement_[client]->addFullView() ; 292 } 293 294 void CScalar::distributeToServer(CContextClient* client, std::map<int, CArray<size_t,1>>& globalIndex) 295 { 296 CContext* context = CContext::getCurrent(); 297 CDistributedElement scatteredElement(1,globalIndex) ; 298 clientToServerConnector_[client] = new CScattererConnector(localElement_->getView(CElementView::FULL), scatteredElement.getView(CElementView::FULL), context->getIntraComm()) ; 299 clientToServerConnector_[client] ->computeConnector() ; 300 } 301 302 233 303 // Definition of some macros 234 304 DEFINE_REF_FUNC(Scalar,scalar)
Note: See TracChangeset
for help on using the changeset viewer.