Changeset 2409
- Timestamp:
- 10/04/22 14:04:11 (2 years ago)
- Location:
- XIOS3/trunk
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS3/trunk/bld.cfg
r2345 r2409 53 53 bld::target xios_server.exe 54 54 bld::target generic_testcase.exe 55 bld::target test_ugrid.exe 55 56 #bld::target test_regular.exe 56 57 #bld::target test_xios2_cmip6.exe -
XIOS3/trunk/src/io/nc4_data_output.cpp
r2395 r2409 492 492 std::vector<StdString> dim0; 493 493 StdString domainName = domain->name; 494 domain->assignMesh(domainName, domain->nvertex);495 domain->mesh->createMeshEpsilon(context->intraComm_, domain->lonvalue, domain->latvalue, domain->bounds_lonvalue, domain->bounds_latvalue);496 494 497 495 StdString node_x = domainName + "_node_x"; … … 609 607 SuperClassWriter::addAttribute("edge_coordinates", edge_x + " " + edge_y, &domainName); 610 608 SuperClassWriter::addAttribute("edge_node_connectivity", edge_nodes, &domainName); 609 SuperClassWriter::addAttribute("face_edge_connectivity", face_edges, &domainName); 610 SuperClassWriter::addAttribute("edge_face_connectivity", edge_faces, &domainName); 611 611 SuperClassWriter::addDimension(dimEdge, domain->mesh->nbEdgesGlo); 612 612 dim0.clear(); … … 628 628 SuperClassWriter::addAttribute("start_index", 0, &edge_nodes); 629 629 } 630 SuperClassWriter::addAttribute("face_face_connectivity", face_faces, &domainName); 630 631 SuperClassWriter::addAttribute("face_coordinates", face_x + " " + face_y, &domainName); 631 632 SuperClassWriter::addAttribute("face_node_connectivity", face_nodes, &domainName); … … 729 730 startNodes[0] = domain->mesh->node_start; 730 731 countNodes[0] = domain->mesh->node_count; 732 if (countNodes[0]==0) startNodes[0]=0 ; // for netcdf error 731 733 startEdgeNodes[0] = domain->ibegin; 732 734 startEdgeNodes[1] = 0; … … 765 767 startNodes[0] = domain->mesh->node_start; 766 768 countNodes[0] = domain->mesh->node_count; 769 if (countNodes[0]==0) startNodes[0]=0; 770 767 771 startEdges[0] = domain->mesh->edge_start; 768 772 countEdges[0] = domain->mesh->edge_count; 773 if (countEdges[0]==0) startEdges[0]=0 ; // for netcdf error 774 769 775 startEdgeNodes[0] = domain->mesh->edge_start; 776 countEdgeNodes[0] = domain->mesh->edge_count; 777 if (countEdgeNodes[0]==0) startEdgeNodes[0]=0; // for netcdf error 770 778 startEdgeNodes[1] = 0; 771 countEdgeNodes[0] = domain->mesh->edge_count;772 779 countEdgeNodes[1]= 2; 780 773 781 startEdgeFaces[0] = domain->mesh->edge_start; 782 countEdgeFaces[0] = domain->mesh->edge_count; 783 if (countEdgeFaces[0]==0) startEdgeFaces[0]=0 ; // for netcdf error 774 784 startEdgeFaces[1]= 0; 775 countEdgeFaces[0] = domain->mesh->edge_count;776 785 countEdgeFaces[1]= 2; 786 777 787 startFaceConctv[0] = domain->ibegin; 788 countFaceConctv[0] = domain->ni; 778 789 startFaceConctv[1] = 0; 779 countFaceConctv[0] = domain->ni;780 790 countFaceConctv[1] = domain->nvertex; 781 791 } -
XIOS3/trunk/src/node/file.cpp
r2400 r2409 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/trunk/src/node/mesh.cpp
r2284 r2409 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.