Changeset 1172
- Timestamp:
- 06/15/17 19:32:13 (7 years ago)
- Location:
- XIOS/dev/branch_yushan_merged
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_yushan_merged/extern/remap/src/elt.hpp
r1016 r1172 53 53 struct Elt : Polyg 54 54 { 55 Elt() {} 56 Elt(const double *bounds_lon, const double *bounds_lat, int max_num_vert) 57 { 58 int k = 0; 59 vertex[k++] = xyz(bounds_lon[0], bounds_lat[0]); 60 for (int i = 1; i < max_num_vert; i++) 61 { 62 vertex[k] = xyz(bounds_lon[i], bounds_lat[i]); 63 /* netCDF convention: if first vertex repeats element is finished (at least three vertices == triagle) */ 64 if (k >= 3 && squaredist(vertex[k], vertex[0]) < EPS*EPS) 65 break; 66 /* eliminate zero edges: move to next vertex only if it is different */ 67 if (squaredist(vertex[k], vertex[k-1]) > EPS*EPS) 68 k++; 69 else 70 /* cout << "Removed edge " << k << " due to zero length (coinciding endpoints)." << endl */ ; 71 } 72 n = k; 73 x = barycentre(vertex, n); 74 } 55 Elt() {} 56 Elt(const double *bounds_lon, const double *bounds_lat, int max_num_vert) 57 { 58 int k = 0; 59 vertex[k++] = xyz(bounds_lon[0], bounds_lat[0]); 60 for (int i = 1; i < max_num_vert; i++) 61 { 62 vertex[k] = xyz(bounds_lon[i], bounds_lat[i]); 63 /* netCDF convention: if first vertex repeats element is finished (at least three vertices == triagle) */ 64 if (k >= 3 && squaredist(vertex[k], vertex[0]) < EPS*EPS) 65 break; 66 /* eliminate zero edges: move to next vertex only if it is different */ 67 if (squaredist(vertex[k], vertex[k-1]) > EPS*EPS) 68 k++; 69 //else cout << "Removed edge " << k << " due to zero length (coinciding endpoints)." << endl ; 70 } 71 n = k; 72 x = barycentre(vertex, n); 73 } 75 74 76 75 Elt& operator=(const Elt& rhs) … … 96 95 } 97 96 98 99 100 101 102 103 104 105 97 void delete_intersections() 98 { 99 for (list<Polyg*>::iterator it = this->is.begin(); it != this->is.end(); it++) 100 { 101 Polyg* poly = *it; 102 delete poly; 103 } 104 } 106 105 107 106 void insert_vertex(int i, const Coord& v) -
XIOS/dev/branch_yushan_merged/extern/remap/src/node.cpp
r1155 r1172 472 472 q->child.resize(MAX_NODE_SZ/2 + 1); 473 473 assert(thIs->child.size() == MAX_NODE_SZ+1); 474 thIs->tree->ref = thIs->closest(thIs->child, FARTHEST); // farthest from centre 474 if(thIs->closest(thIs->child, FARTHEST) == 0) 475 thIs->tree->ref = thIs->closest(thIs->child, FARTHEST); // farthest from centre 476 477 thIs->tree->ref = thIs->closest(thIs->child, FARTHEST); // farthest from centre 478 479 475 480 std::sort(thIs->child.begin(), thIs->child.end(), compareDist); 476 481 for (int i = 0; i < MAX_NODE_SZ+1; i++) -
XIOS/dev/branch_yushan_merged/extern/remap/src/parallel_tree.cpp
r1155 r1172 315 315 { 316 316 317 318 317 int assignLevel = 2; 318 int nbSampleNodes = 2*ipow(MAX_NODE_SZ + 1, assignLevel); 319 319 320 320 … … 326 326 MPI_Comm_size(communicator,&commSize) ; 327 327 328 329 330 331 //assert( nbTot > nbSampleNodes*commSize) ;328 // make multiple of two 329 nbSampleNodes /= 2; 330 nbSampleNodes *= 2; 331 //assert( nbTot > nbSampleNodes*commSize) ; 332 332 333 333 int nbSampleNodes1 = nbSampleNodes * (nb1*commSize)/(1.*nbTot) ; … … 335 335 336 336 337 //assert(node.size() > nbSampleNodes);338 //assert(node2.size() > nbSampleNodes);339 //assert(node.size() + node2.size() > nbSampleNodes);340 341 342 343 344 345 337 //assert(node.size() > nbSampleNodes); 338 //assert(node2.size() > nbSampleNodes); 339 //assert(node.size() + node2.size() > nbSampleNodes); 340 vector<Node> sampleNodes; sampleNodes.reserve(nbSampleNodes1+nbSampleNodes2); 341 342 vector<int> randomArray1(node.size()); 343 randomizeArray(randomArray1); 344 vector<int> randomArray2(node2.size()); 345 randomizeArray(randomArray2); 346 346 347 347 /* -
XIOS/dev/branch_yushan_merged/extern/remap/src/tree.cpp
r1134 r1172 29 29 void CBasicTree::routeNodes(vector<int>& route, vector<Node>& nodes, int assignLevel) 30 30 { 31 32 33 34 35 31 for (int i = 0; i < nodes.size(); i++) 32 { 33 root->routeNode(&nodes[i], assignLevel); 34 route[i] = nodes[i].route; 35 } 36 36 } 37 37 38 38 void CBasicTree::routeIntersections(vector<vector<int> >& routes, vector<Node>& nodes) 39 39 { 40 41 40 for (int i = 0; i < nodes.size(); i++) 41 root->routeIntersection(routes[i], &nodes[i]); 42 42 } 43 43 44 44 void CBasicTree::build(vector<Node>& nodes) 45 45 { 46 47 46 newRoot(1); 47 insertNodes(nodes); 48 48 } 49 49 50 50 void CBasicTree::output(ostream& flux, int level) 51 51 { 52 52 root->output(flux,level,0) ; 53 53 } 54 54 void CBasicTree::slim(int nbIts) 55 55 { 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 56 for (int i = 0; i < nbIts; i++) 57 { 58 for (int level = root->level - 1; level > 0; level--) 59 { 60 slim2(root, level); 61 ri = 0; 62 emptyPool(); 63 } 64 65 for (int level = 2; level < root->level; level++) 66 { 67 slim2(root, level); 68 ri = 0; 69 emptyPool(); 70 } 71 } 72 72 } 73 73 … … 76 76 void CBasicTree::insertNode(NodePtr node) 77 77 { 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 78 node->tree = this; 79 increaseLevelSize(0); 80 push_back(node); 81 82 NodePtr q; 83 while (pool.size()) 84 { 85 q = pool.front(); 86 pool.pop_front(); 87 q = insert(q, root); 88 if (ri) 89 { 90 delete q; 91 ri = 0; 92 } 93 } 94 94 } 95 95 96 96 void CBasicTree::emptyPool(void) 97 97 { 98 99 100 101 102 103 104 105 106 107 108 98 while (pool.size()) 99 { 100 NodePtr q = pool.front(); 101 pool.pop_front(); 102 q = insert(q, root); 103 if (ri) 104 { 105 delete q; 106 ri = 0; 107 } 108 } 109 109 } 110 110 -
XIOS/dev/branch_yushan_merged/extern/remap/src/tree.hpp
r923 r1172 14 14 class CBasicTree 15 15 { 16 public:16 public: 17 17 18 19 20 21 22 18 NodePtr root; /* The main tree is stored as Nodes which can be reached through traversal starting here */ 19 NodePtr ref; // FIXME this reference, set by a node is odd, try to remove 20 int ri; /** this is set to one by a node in case of reinsertion */ 21 vector<int> levelSize; /** e.g. levelSize[0] == leafs.size() */ 22 vector<Node> leafs; /** leafs are stored in vector for easy access and rest of the tree nodes as separate allocations, only reachable through tree traversal */ 23 23 24 25 26 27 28 24 CBasicTree() : ri(0), levelSize(MAX_LEVEL_SIZE), root(NULL), isAssignedLevel(false), okSplit(true), isActiveOkSplit(false) {} 25 ~CBasicTree(); 26 void build(vector<Node>& nodes); 27 void slim(int nbIts = 1); 28 virtual void insertNodes(vector<Node>& node) = 0; 29 29 30 31 30 void routeNodes(vector<int>& route, vector<Node>& nodes, int assignLevel); 31 void routeIntersections(vector<vector<int> >& route, vector<Node>& nodes); 32 32 33 34 35 36 37 38 33 void push_back(NodePtr node); 34 void push_front(NodePtr node); 35 void increaseLevelSize(int level); 36 void decreaseLevelSize(int level); 37 void newRoot(int level); 38 void insertNode(NodePtr node); 39 39 void output(ostream& flux, int level) ; 40 40 41 41 int keepNodes; 42 42 bool isAssignedLevel ; 43 43 int assignLevel; … … 50 50 51 51 52 private:53 52 private: 53 deque<NodePtr > pool; 54 54 55 55 bool okSplit ; 56 56 57 protected:57 protected: 58 58 void emptyPool(); 59 CBasicTree(int keepNodes_, int assignLevel_) : ri(0), levelSize(MAX_LEVEL_SIZE), root(NULL), keepNodes(keepNodes_), assignLevel(assignLevel_), isAssignedLevel(true), okSplit(true), isActiveOkSplit(false) {} 59 CBasicTree(int keepNodes_, int assignLevel_) : ri(0), levelSize(MAX_LEVEL_SIZE), root(NULL), keepNodes(keepNodes_), assignLevel(assignLevel_), isAssignedLevel(true), 60 okSplit(true), isActiveOkSplit(false) {} 60 61 }; 61 62 62 63 class CTree : public CBasicTree 63 64 { 64 public:65 65 public: 66 void insertNodes(vector<Node>& nodes); 66 67 }; 67 68 … … 69 70 { 70 71 71 public:72 72 public: 73 CSampleTree(int keepNodes_, int assignLevel_) : CBasicTree(keepNodes_,assignLevel_) {} 73 74 void slimAssignedLevel() ; 74 75 void removeExtraNode(void) ; 75 76 void insertNodes(vector<Node>& nodes); 76 77 }; 77 78 -
XIOS/dev/branch_yushan_merged/inputs/REMAP/iodef.xml
r1164 r1172 34 34 35 35 <file_definition type="one_file" par_access="collective" output_freq="1ts" output_level="10" enabled=".TRUE."> 36 37 <file_group id="read_then_write_files" enabled=".TRUE."> 38 <file id="output_regular_pole" name="output_dst_regular" > 39 <field field_ref="tmp_field_0" name="field_regular_0" enabled=".TRUE."/> 40 <field field_ref="dst_field_regular" name="field_regular" enabled=".TRUE."/> 41 <field field_ref="dst_field_regular_pole_0" name="field_regular_pole_0" enabled=".FALSE." /> 42 <field field_ref="dst_field_regular_pole_1" name="field_regular_pole_1" enabled=".FALSE." /> 43 </file> 44 <file id="output_dst_curvilinear" name="output_dst_curvilinear" enabled=".TRUE." > 45 <field field_ref="tmp_field_1" operation="instant"/> 46 </file> 47 <file id="output_dst_unstructured" name="output_dst_unstructured" enabled=".TRUE." > 48 <field field_ref="tmp_field_2" operation="instant"/> 49 </file> 50 </file_group> 51 36 52 <file_group id="write_files" > 37 <file id="output_2D" name="output_2D" >53 <file id="output_2D" name="output_2D" enabled=".TRUE."> 38 54 <field field_ref="src_field_2D" name="field_src" /> 39 55 <field field_ref="src_field_2D_clone" name="field_src_clone" default_value="100000" /> … … 44 60 <field field_ref="dst_field_2D_extract" name="field_dst_regular_4" /> 45 61 </file> 46 <file id="output_3D" name="output_3D" enabled=".TRUE." 62 <file id="output_3D" name="output_3D" enabled=".TRUE."> 47 63 <field field_ref="src_field_3D" name="field_src" /> 48 64 <field field_ref="src_field_3D_pression" name="field" /> … … 66 82 </file> 67 83 </file_group> 68 <file_group id="read_then_write_files" enabled=".TRUE."> 69 <file id="output_regular_pole" name="output_dst_regular" > 70 <field field_ref="tmp_field_0" name="field_regular_0" /> 71 <field field_ref="dst_field_regular" name="field_regular" /> 72 <field field_ref="dst_field_regular_pole_0" name="field_regular_pole_0" enabled=".FALSE." /> 73 <field field_ref="dst_field_regular_pole_1" name="field_regular_pole_1" enabled=".FALSE." /> 74 </file> 75 <file id="output_dst_curvilinear" name="output_dst_curvilinear"> 76 <field field_ref="tmp_field_1" operation="instant"/> 77 </file> 78 <file id="output_dst_unstructured" name="output_dst_unstructured" > 79 <field field_ref="tmp_field_2" operation="instant"/> 80 </file> 81 </file_group> 84 82 85 </file_definition> 83 86 -
XIOS/dev/branch_yushan_merged/src/client_client_dht_template_impl.hpp
r1164 r1172 718 718 MPI_Irecv(&recvBuff[0]+2*idx, 2, MPI_INT, 719 719 recvRank[idx], MPI_DHT_INDEX_0, this->internalComm_, &request[nRequest]); 720 printf("proc %d recv from proc %d with tag %d\n", my_rank, recvRank[idx], MPI_DHT_INDEX_0);721 720 ++nRequest; 722 721 } … … 735 734 MPI_Isend(&sendBuff[idx*2], 2, MPI_INT, 736 735 sendRank[idx], MPI_DHT_INDEX_0, this->internalComm_, &request[nRequest]); 737 printf("proc %d send to proc %d with tag %d\n", my_rank, sendRank[idx], MPI_DHT_INDEX_0);738 736 ++nRequest; 739 737 } -
XIOS/dev/branch_yushan_merged/src/io/inetcdf4.cpp
r1138 r1172 21 21 comm = NULL; 22 22 } 23 23 24 mpi = comm && !multifile; 24 25 MPI_Info m_info = MPI_INFO_NULL_STD; -
XIOS/dev/branch_yushan_merged/src/io/nc4_data_input.cpp
r1138 r1172 55 55 CArray<double,1> fieldData(grid->getWrittenDataSize()); 56 56 if (!field->default_value.isEmpty()) fieldData = field->default_value; 57 57 #ifdef _usingEP 58 SuperClass::type = ONE_FILE; 59 //printf("SuperClass::type = %d\n", SuperClass::type); 60 #endif 58 61 switch (SuperClass::type) 59 62 { -
XIOS/dev/branch_yushan_merged/src/io/nc4_data_output.cpp
r1160 r1172 1102 1102 1103 1103 SuperClassWriter::definition_end(); 1104 1104 printf("SuperClass::type = %d\n", SuperClass::type); 1105 1105 switch (SuperClass::type) 1106 1106 { -
XIOS/dev/branch_yushan_merged/src/node/file.cpp
r1160 r1172 579 579 580 580 #ifdef _usingEP 581 if(omp_get_num_threads() != 1 ) multifile = true; 582 #endif 583 581 //printf("multifile was %d\n", multifile); 582 multifile = true; 584 583 if (isOpen) data_out->closeFile(); 585 584 if (time_counter_name.isEmpty()) data_in = shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), static_cast< ::MPI_Comm >(fileComm.mpi_comm), multifile, isCollective)); 586 585 else data_in = shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), static_cast< ::MPI_Comm >(fileComm.mpi_comm), multifile, isCollective, time_counter_name)); 587 586 isOpen = true; 587 #else 588 if (isOpen) data_out->closeFile(); 589 if (time_counter_name.isEmpty()) data_in = shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), static_cast< ::MPI_Comm >(fileComm.mpi_comm), multifile, isCollective)); 590 else data_in = shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), static_cast< ::MPI_Comm >(fileComm.mpi_comm), multifile, isCollective, time_counter_name)); 591 isOpen = true; 592 #endif 593 594 588 595 } 589 596 }
Note: See TracChangeset
for help on using the changeset viewer.