Changeset 2417 for XIOS3/branches/xios-3.0-beta/src/node
- Timestamp:
- 10/06/22 12:50:04 (21 months ago)
- Location:
- XIOS3/branches/xios-3.0-beta/src/node
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS3/branches/xios-3.0-beta/src/node/file.cpp
r2400 r2417 863 863 std::vector<int> domainNvertices; 864 864 std::vector<StdString> domainNames; 865 std::map<string, tuple<set<CDomain*>,set<CDomain*>,set<CDomain*>>> registeredDomains ; 865 866 866 867 for (int i = 0; i < size; ++i) … … 905 906 domainNvertices.push_back(nvertex); 906 907 } 908 909 if (nvertex==1) std::get<0>(registeredDomains[domainName]).insert(domain[0]) ; 910 else if (nvertex==2) std::get<1>(registeredDomains[domainName]).insert(domain[0]) ; 911 else std::get<2>(registeredDomains[domainName]).insert(domain[0]) ; 912 } 913 914 for(auto& it:registeredDomains) 915 { 916 list<CDomain*> domains ; 917 string domainName=it.first ; 918 919 for(auto& domain : std::get<0>(it.second) ) domains.push_back(domain) ; 920 for(auto& domain : std::get<1>(it.second) ) domains.push_back(domain) ; 921 for(auto& domain : std::get<2>(it.second) ) domains.push_back(domain) ; 922 923 // for each component of a given mesh (i.e. domains with same name but different number of vertices) 924 // associate the UGRID mesh in increasing order 925 for(auto& domain : domains ) 926 { 927 //domain-> computeWrittenIndex(); 928 //CArray<int, 1>& indexToWrite = domain->localIndexToWriteOnServer; 929 CArray<int, 1> indexToWrite = domain->getLocalView(CElementView::WORKFLOW)->getIndex(); 930 int nbWritten = indexToWrite.numElements(); 931 932 CArray<double,1> writtenLat, writtenLon; 933 CArray<double,2> writtenBndsLat, writtenBndsLon; 934 935 writtenLat.resize(nbWritten); 936 writtenLon.resize(nbWritten); 937 for (int idx = 0; idx < nbWritten; ++idx) 938 { 939 writtenLat(idx) = domain->latvalue(indexToWrite(idx)); 940 writtenLon(idx) = domain->lonvalue(indexToWrite(idx)); 941 } 942 943 int nvertex = domain->nvertex, idx; 944 if (nvertex>1) 945 { 946 writtenBndsLat.resize(nvertex, nbWritten); 947 writtenBndsLon.resize(nvertex, nbWritten); 948 CArray<double,2>& boundslat = domain->bounds_latvalue; 949 CArray<double,2>& boundslon = domain->bounds_lonvalue; 950 for (idx = 0; idx < nbWritten; ++idx) 951 for (int nv = 0; nv < nvertex; ++nv) 952 { 953 writtenBndsLat(nv, idx) = boundslat(nv, int(indexToWrite(idx))); 954 writtenBndsLon(nv, idx) = boundslon(nv, int(indexToWrite(idx))); 955 } 956 } 957 domain->assignMesh(domainName, domain->nvertex); 958 //CContextServer* server=CContext::getCurrent()->server ; 959 //domain->mesh->createMeshEpsilon(server->intraComm, writtenLon, writtenLat, writtenBndsLon, writtenBndsLat); 960 MPI_Comm intraComm =CContext::getCurrent()->getIntraComm() ; 961 domain->mesh->createMeshEpsilon(intraComm, writtenLon, writtenLat, writtenBndsLon, writtenBndsLat); 962 } 963 907 964 } 908 965 } -
XIOS3/branches/xios-3.0-beta/src/node/mesh.cpp
r2284 r2417 430 430 if (nvertex == 1) 431 431 { 432 if (nodesAreWritten) return ; 433 432 434 nbNodes_ = lonvalue.numElements(); 433 435 node_lon.resize(nbNodes_); … … 435 437 node_lon = lonvalue; 436 438 node_lat = latvalue; 439 440 unsigned long nodeCount = nbNodes_; 441 unsigned long nodeStart, nbNodes; 442 MPI_Scan(&nodeCount, &nodeStart, 1, MPI_UNSIGNED_LONG, MPI_SUM, comm); 443 int nNodes = nodeStart; 444 MPI_Bcast(&nNodes, 1, MPI_UNSIGNED_LONG, mpiSize-1, comm); 445 nbNodesGlo = nNodes; 446 447 nodeStart -= nodeCount; 448 node_start = nodeStart; 449 node_count = nodeCount; 437 450 438 451 // Global node indexes … … 444 457 for (size_t nh = 0; nh < 4; ++nh) 445 458 { 446 nodeHash2IdxGlo[hashValues[nh]].push_back( mpiRank*nbNodes_+ nn);459 nodeHash2IdxGlo[hashValues[nh]].push_back(nodeStart + nn); 447 460 } 448 461 } … … 453 466 else if (nvertex == 2) 454 467 { 468 if (edgesAreWritten) return ; 469 455 470 nbEdges_ = bounds_lon.shape()[1]; 456 471 edge_lon.resize(nbEdges_); … … 463 478 unsigned long nbEdgesOnProc = nbEdges_; 464 479 unsigned long nbEdgesAccum; 480 unsigned long nbEdgesGlo; 465 481 MPI_Scan(&nbEdgesOnProc, &nbEdgesAccum, 1, MPI_UNSIGNED_LONG, MPI_SUM, comm); 482 nbEdgesGlo = nbEdgesAccum ; 483 MPI_Bcast(&nbEdgesGlo, 1, MPI_UNSIGNED_LONG, mpiSize-1, comm); 466 484 nbEdgesAccum -= nbEdges_; 485 edge_start = nbEdgesAccum ; 486 edge_count = nbEdgesOnProc ; 467 487 468 488 CClientClientDHTSizet::Index2VectorInfoTypeMap edgeHash2IdxGlo; … … 674 694 } //nvertex = 2 675 695 676 else 677 { 696 else // nvertex > 2 697 { 698 if (facesAreWritten) return ; 699 678 700 nbFaces_ = bounds_lon.shape()[1]; 679 701 face_lon.resize(nbFaces_);
Note: See TracChangeset
for help on using the changeset viewer.