Changeset 821
- Timestamp:
- 02/10/16 14:35:03 (7 years ago)
- Location:
- XIOS/trunk
- Files:
-
- 1 added
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/doc/XIOS_reference_guide.lyx
r797 r821 1418 1418 \end_layout 1419 1419 1420 \begin_layout Subsection* 1421 index: 1422 \begin_inset Flex Emph 1423 status collapsed 1424 1425 \begin_layout Plain Layout 1426 1D-array of double 1427 \end_layout 1428 1429 \end_inset 1430 1431 1432 \end_layout 1433 1434 \begin_layout Standard 1435 Fortran: 1436 \end_layout 1437 1438 \begin_layout LyX-Code 1439 DOUBLE PRECISION :: index(:) 1440 \end_layout 1441 1442 \begin_layout Standard 1443 Define the global index of axis which the local axis holds. 1444 This attribute is optional and the size of the array is equal to 1445 \begin_inset Flex Strong 1446 status collapsed 1447 1448 \begin_layout Plain Layout 1449 n 1450 \end_layout 1451 1452 \end_inset 1453 1454 . 1455 \end_layout 1456 1420 1457 \begin_layout Section 1421 1458 Domain attribute reference … … 1543 1580 \begin_layout Standard 1544 1581 Define the type of the grid. 1582 This attribute is mandatory. 1545 1583 \end_layout 1546 1584 … … 1877 1915 1878 1916 . 1879 This attribute is mandatory.1917 This attribute is optional. 1880 1918 \end_layout 1881 1919 … … 1947 1985 1948 1986 . 1949 This attribute is mandatory.1987 This attribute is optional. 1950 1988 \end_layout 1951 1989 … … 2423 2461 2424 2462 \begin_layout Standard 2425 Define the size of the field data for the firstdimension.2426 This attribute is take account only if2463 Define the size of the field data for the second dimension. 2464 This attribute is taken account only if 2427 2465 \begin_inset Flex Strong 2428 2466 status collapsed … … 2561 2599 in the output file. 2562 2600 This value is useful in case a field is stored linearly in memory. 2563 2601 This attribute is optional. 2564 2602 \end_layout 2565 2603 … … 2610 2648 \begin_layout Standard 2611 2649 Define the reference of the domain. 2612 All attributes are inherited from the referenced domain with the classic al2650 All attributes are inherited from the referenced domain with the classic 2613 2651 inheritance mechanism. 2614 2652 The value assigned to the referenced domain is transmitted to to current … … 2617 2655 \end_layout 2618 2656 2657 \begin_layout Subsection* 2658 i_index: 2659 \begin_inset Flex Emph 2660 status collapsed 2661 2662 \begin_layout Plain Layout 2663 1D-array of double 2664 \end_layout 2665 2666 \end_inset 2667 2668 2669 \end_layout 2670 2671 \begin_layout Standard 2672 Fortran: 2673 \end_layout 2674 2675 \begin_layout LyX-Code 2676 DOUBLE PRECISION :: i_index(:) 2677 \end_layout 2678 2679 \begin_layout Standard 2680 Define the global index of the first dimension of domain which the local 2681 domain holds. 2682 This attribute is optional and by default, the size of the array is equal 2683 to 2684 \begin_inset Flex Strong 2685 status collapsed 2686 2687 \begin_layout Plain Layout 2688 ni*nj 2689 \end_layout 2690 2691 \end_inset 2692 2693 . 2694 \end_layout 2695 2696 \begin_layout Subsection* 2697 j_index: 2698 \begin_inset Flex Emph 2699 status collapsed 2700 2701 \begin_layout Plain Layout 2702 1D-array of double 2703 \end_layout 2704 2705 \end_inset 2706 2707 2708 \end_layout 2709 2710 \begin_layout Standard 2711 Fortran: 2712 \end_layout 2713 2714 \begin_layout LyX-Code 2715 DOUBLE PRECISION :: j_index(:) 2716 \end_layout 2717 2718 \begin_layout Standard 2719 Define the global index of the second dimension of domain which the local 2720 domain holds. 2721 This attribute is optional and by default, the size of the array is equal 2722 to 2723 \begin_inset Flex Strong 2724 status collapsed 2725 2726 \begin_layout Plain Layout 2727 ni*nj 2728 \end_layout 2729 2730 \end_inset 2731 2732 . 2733 \end_layout 2734 2619 2735 \begin_layout Section 2620 2736 Grid attribute reference … … 2657 2773 2658 2774 \begin_layout Subsection* 2659 mask :2775 mask_1d: 2660 2776 \emph on 2661 2777 1D-array of bool … … 2667 2783 2668 2784 \begin_layout LyX-Code 2669 LOGICAL :: mask (:)2785 LOGICAL :: mask_1d(:) 2670 2786 \end_layout 2671 2787 … … 2688 2804 2689 2805 \begin_layout Subsection* 2690 mask :2806 mask_2d: 2691 2807 \emph on 2692 2808 2D-array of bool … … 2698 2814 2699 2815 \begin_layout LyX-Code 2700 LOGICAL :: mask (:,:)2816 LOGICAL :: mask_2d(:,:) 2701 2817 \end_layout 2702 2818 … … 2719 2835 2720 2836 \begin_layout Subsection* 2721 mask :2837 mask_3d: 2722 2838 \emph on 2723 2839 3D-array of bool … … 2729 2845 2730 2846 \begin_layout LyX-Code 2731 LOGICAL :: mask (:,:,:)2847 LOGICAL :: mask_3d(:,:,:) 2732 2848 \end_layout 2733 2849 … … 3237 3353 3238 3354 \begin_layout Subsection* 3355 grid_path: 3356 \emph on 3357 string 3358 \end_layout 3359 3360 \begin_layout Standard 3361 Fortran: 3362 \end_layout 3363 3364 \begin_layout LyX-Code 3365 CHARACTER(LEN=*) :: grid_path 3366 \end_layout 3367 3368 \begin_layout Standard 3369 Define the way operations passing from a grid to others. 3370 This attribute is optional. 3371 \end_layout 3372 3373 \begin_layout Subsection* 3239 3374 default_value: 3240 3375 \emph on … … 3624 3759 3625 3760 \begin_layout Subsection* 3761 description: 3762 \emph on 3763 string 3764 \end_layout 3765 3766 \begin_layout Standard 3767 Fortran: 3768 \end_layout 3769 3770 \begin_layout LyX-Code 3771 CHARACTER(LEN=*) :: description 3772 \end_layout 3773 3774 \begin_layout Standard 3775 Define the description of the file. 3776 This attribute is optional. 3777 \end_layout 3778 3779 \begin_layout Subsection* 3626 3780 name_suffix: 3627 3781 \emph on … … 4031 4185 \emph default 4032 4186 . 4033 \begin_inset Newline newline 4034 \end_inset 4035 4036 4037 \begin_inset Newline newline 4038 \end_inset 4039 4040 Note that the 4187 Note that the 4041 4188 \series bold 4042 4189 \emph on … … 4237 4384 4238 4385 \begin_layout Subsection* 4386 time_counter_name: 4387 \emph on 4388 string 4389 \end_layout 4390 4391 \begin_layout Standard 4392 Fortran: 4393 \end_layout 4394 4395 \begin_layout LyX-Code 4396 CHARACTER(LEN=*) :: time_counter_name 4397 \end_layout 4398 4399 \begin_layout Standard 4400 Define the name of the time counter. 4401 This attribute is optional. 4402 \end_layout 4403 4404 \begin_layout Subsection* 4239 4405 timeseries: 4240 4406 \emph on … … 4247 4413 4248 4414 \begin_layout LyX-Code 4249 CHARACTER(LEN=*) :: time_ counter4415 CHARACTER(LEN=*) :: time_series 4250 4416 \end_layout 4251 4417 … … 4326 4492 \series default 4327 4493 will be used. 4494 \end_layout 4495 4496 \begin_layout Subsection* 4497 record_offset: 4498 \emph on 4499 integer 4500 \end_layout 4501 4502 \begin_layout Standard 4503 Fortran: 4504 \end_layout 4505 4506 \begin_layout LyX-Code 4507 INTEGER :: record_offset 4508 \end_layout 4509 4510 \begin_layout Standard 4511 Define offset of record from the beginning record. 4512 This attribute is optional, by default, its value is 0. 4328 4513 \end_layout 4329 4514 -
XIOS/trunk/doc/inputs/user/Domain.lyx
r797 r821 317 317 interpolation_domain: Implement interpolation from a domain to one another, 318 318 for now XIOS can only do interpolation by reading calculated weight values 319 from a file. 320 The calculation on the fly will be implemented soon. 319 from a file or calculate the weights on the fly. 321 320 \end_layout 322 321 … … 496 495 per client process. 497 496 In the next sections, local describes everything related to a client process, 498 whereas global means wholedata.497 whereas global means global data. 499 498 The followings describe the essential parts of domain. 500 499 Details of its attributes and operations can be found in XIOS reference … … 533 532 curvilinear: a 2-dimensional coordinates allows the generality of two axes 534 533 not perpendicular to each other. 535 Latitude and longitude have the size equivalent to size of wholedomain.534 Latitude and longitude have the size equivalent to size of local domain. 536 535 537 536 \end_layout … … 692 691 \begin_layout Plain Layout 693 692 694 CALL xios_set_domain_attr("domain_A",i_index=iIndex, j_index=jIndex) 693 CALL xios_set_domain_attr("domain_A",ni_glo=9, nj_glo=9, i_index=iIndex, 694 j_index=jIndex) 695 695 \end_layout 696 696 … … 1030 1030 1031 1031 \begin_layout Standard 1032 For cur linear mesh, bounds_lon_2d and bounds_lat_2d provide a convenient1032 For curvilinear mesh, bounds_lon_2d and bounds_lat_2d provide a convenient 1033 1033 way to define longitude and latitude value for the vertex of the cell. 1034 1034 However, it is possible to use bounds_lon_1d and bounds_lat_1d to describe -
XIOS/trunk/inputs/REMAP/iodef.xml
r820 r821 64 64 <generate_rectilinear_domain id="domain_regular_pole"/> 65 65 <interpolate_domain/> 66 <!-- <zoom_domain id="zoom_0" ibegin="0" ni="180" jbegin="0" nj="90"/>-->66 <zoom_domain id="zoom_0" ibegin="0" ni="90" jbegin="0" nj="90"/> 67 67 </domain> 68 68 <domain id="dst_domain_regular" ni_glo="90" nj_glo="45" type="rectilinear"> -
XIOS/trunk/inputs/Unstruct/iodef.xml
r818 r821 5 5 <calendar type="Gregorian" start_date="2012-03-01 15:00:00" time_origin="2012-02-28 15:00:00 + 1d" /> 6 6 7 <field_definition level="1" enabled=".TRUE." >7 <field_definition level="1" enabled=".TRUE." default_value="1000"> 8 8 <field id="field_A_srf" operation="average" freq_op="3600s" grid_ref="grid_A"/> 9 9 </field_definition> 10 10 11 <file_definition type="one_file" par_access="collective" output_freq="6h" output_level="10" enabled=".TRUE." >11 <file_definition type="one_file" par_access="collective" output_freq="6h" output_level="10" enabled=".TRUE." > 12 12 <file id="output" name="output"> 13 <field field_ref="field_A_srf" name="field_A_srf" 13 <field field_ref="field_A_srf" name="field_A_srf"/> 14 14 </file> 15 15 </file_definition> -
XIOS/trunk/inputs/Version2/iodef.xml
r775 r821 22 22 </file> 23 23 <file id="output_Axis" name="output_Axis" type="one_file"> 24 <!-- <field field_ref="field_Axis" />--> 24 <field field_ref="field_Axis" /> 25 </file> 26 <file id="output_Two_Axis" name="output_Two_Axis" type="one_file"> 27 <field field_ref="field_Two_Axis" /> 25 28 </file> 26 29 <file id="output_All_Axis" name="output_All_Axis" type="one_file"> 27 <!-- <field field_ref="field_All_Axis" />-->30 <field field_ref="field_All_Axis" /> 28 31 </file> 29 32 <file id="output_Axis_transformed" name="output_Axis_transformed" type="one_file"> 30 <!-- <field field_ref="field_Axis_transformed" />-->33 <field field_ref="field_Axis_transformed" /> 31 34 </file> 32 35 <file id="output_Axis_transformed_interpolated" name="output_Axis_transformed_interpolated"> 33 <!-- <field field_ref="field_Axis_transformed_Interpolated" />-->36 <field field_ref="field_Axis_transformed_Interpolated" /> 34 37 </file> 35 38 <file id="output_Domain_transformed_interpolated" name="output_Domain_transformed_interpolated" type="one_file"> … … 46 49 <axis id="axis_C" /> 47 50 <axis id="axis_D" /> 48 <axis id="axis_E" axis_ref="axis_A"> 49 <inverse_axis /> 50 </axis> 51 <axis id="axis_F" axis_ref="axis_B"> 52 <inverse_axis /> 53 <zoom_axis zoom_begin="0" zoom_size="4" /> 54 <inverse_axis /> 55 </axis> 56 <axis id="axis_G" axis_ref="axis_D"> 51 <axis id="axis_E"> 57 52 <interpolate_axis type="polynomial" order="3"/> 58 53 </axis> 59 <axis id="axis_H" axis_ref="axis_C"> 60 <!-- <inverse_axis />--> 61 <!-- <zoom_axis zoom_begin="0" zoom_size="1" />--> 54 <axis id="axis_F" axis_ref="axis_C"> 55 <inverse_axis /> 56 <zoom_axis begin="0" n="4" /> 57 <inverse_axis /> 62 58 </axis> 63 59 </axis_definition> … … 65 61 <domain_definition> 66 62 <domain id="domain_A" /> 67 <domain id="domain_A_zoom" domain_ref="domain_A"> 68 <!-- <zoom_domain zoom_ibegin="1" zoom_ni="3" zoom_jbegin="0" zoom_nj="2"/>--> 69 <zoom_domain zoom_ibegin="1" zoom_ni="9" zoom_jbegin="0" zoom_nj="2"/> 70 <!-- <zoom_domain zoom_ibegin="0" zoom_ni="2" zoom_jbegin="0" zoom_nj="2"/>--> 71 </domain> 72 <domain id="domain_A_transformed" domain_src="domain_A"> 73 <!-- <interpolate_from_file_domain file="" />--> 63 <domain id="domain_A_transformed"> 74 64 <generate_rectilinear_domain /> 75 65 </domain> … … 95 85 </grid> 96 86 <grid id="grid_Axis_tranformed"> 97 <!-- <domain domain_ref="domain_A" />--> 98 <domain domain_ref="domain_A_zoom" /> 99 <axis axis_ref="axis_H" /> 100 <!-- <axis axis_ref="axis_E" />--> 101 <!-- <axis axis_ref="axis_F" />--> 87 <domain domain_ref="domain_A" /> 88 <axis axis_ref="axis_F" /> 102 89 </grid> 103 90 <grid id="grid_Domain_tranformed_Interpolated"> 104 91 <domain domain_ref="domain_A_transformed" /> 105 <axis axis_ref="axis_ H" />92 <axis axis_ref="axis_C" /> 106 93 </grid> 107 94 <grid id="grid_Axis_tranformed_Interpolated"> 108 <axis axis_ref="axis_ G" />95 <axis axis_ref="axis_E" /> 109 96 </grid> 110 97 <grid id="ScalarGrid"> -
XIOS/trunk/src/config/domain_attribute_private.conf
r775 r821 13 13 DECLARE_ARRAY_PRIVATE(double, 1, lonvalue_rectilinear_read_from_file) 14 14 DECLARE_ARRAY_PRIVATE(double, 1, latvalue_rectilinear_read_from_file) 15 16 DECLARE_ATTRIBUTE_PRIVATE(int, global_zoom_ibegin) 17 DECLARE_ATTRIBUTE_PRIVATE(int, global_zoom_ni) 18 DECLARE_ATTRIBUTE_PRIVATE(int, global_zoom_jbegin) 19 DECLARE_ATTRIBUTE_PRIVATE(int, global_zoom_nj) -
XIOS/trunk/src/distribution_client.cpp
r818 r821 235 235 nBeginGlobal_.at(indexMap_[idx]) = axisList[axisIndex]->begin.getValue(); 236 236 nZoomBegin_.at((indexMap_[idx])) = axisList[axisIndex]->global_zoom_begin; 237 nZoomEnd_.at((indexMap_[idx])) = axisList[axisIndex]->global_zoom_begin + axisList[axisIndex]->global_zoom_ size-1;237 nZoomEnd_.at((indexMap_[idx])) = axisList[axisIndex]->global_zoom_begin + axisList[axisIndex]->global_zoom_n-1; 238 238 239 239 dataBegin_.at(indexMap_[idx]) = axisList[axisIndex]->data_begin.getValue(); -
XIOS/trunk/src/io/nc4_data_output.cpp
r819 r821 625 625 int zoom_begin_srv = axis->zoom_begin_srv; 626 626 int zoom_size = (MULTI_FILE == SuperClass::type) ? zoom_size_srv 627 : axis->global_zoom_ size;627 : axis->global_zoom_n; 628 628 int zoom_begin = (MULTI_FILE == SuperClass::type) ? zoom_begin_srv 629 629 : axis->global_zoom_begin; -
XIOS/trunk/src/mpi_tag.hpp
r720 r821 14 14 #define MPI_DHT_INFO_0 22 15 15 16 /* Tag for mpi communication to send and receive info of current grid source in grid transformation*/ 17 #define MPI_GRID_TRANSFORMATION_CURRENT_GRID_INDEX 31 18 19 /* Tag for mpi communication to send and receive info of current grid source in grid transformation*/ 20 #define MPI_GRID_TRANSFORMATION_ORIGINAL_GRID_INDEX 32 21 22 /* Tag for mpi communication to send and receive info of current grid source in grid transformation*/ 23 #define MPI_GRID_TRANSFORMATION_ORIGINAL_GRID_WEIGHT 33 24 25 /* Tag for mpi communication to send and receive info of DOMAIN in domain interpolation*/ 26 #define MPI_DOMAIN_INTERPOLATION_DEST_INDEX 7 27 28 /* Tag for mpi communication to send and receive info of DOMAIN in domain interpolation*/ 29 #define MPI_DOMAIN_INTERPOLATION_SRC_INDEX 8 30 31 /* Tag for mpi communication to send and receive info of DOMAIN in domain interpolation*/ 32 #define MPI_DOMAIN_INTERPOLATION_WEIGHT 9 33 16 34 #endif -
XIOS/trunk/src/node/axis.cpp
r817 r821 26 26 , isDistributed_(false), hasBounds_(false), isCompressible_(false) 27 27 , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 28 , transformationMap_(), global_zoom_begin(0), global_zoom_size(0),hasValue(false)28 , transformationMap_(), hasValue(false) 29 29 { 30 30 } … … 35 35 , isDistributed_(false), hasBounds_(false), isCompressible_(false) 36 36 , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 37 , transformationMap_(), global_zoom_begin(0), global_zoom_size(0),hasValue(false)37 , transformationMap_(), hasValue(false) 38 38 { 39 39 } … … 266 266 void CAxis::checkZoom(void) 267 267 { 268 if (0 == global_zoom_size) global_zoom_size = this->n_glo.getValue(); 268 if (global_zoom_begin.isEmpty()) global_zoom_begin.setValue(0); 269 if (global_zoom_n.isEmpty()) global_zoom_n.setValue(n_glo.getValue()); 269 270 } 270 271 … … 391 392 size_t ni = this->n.getValue(); 392 393 size_t ibegin = this->begin.getValue(); 393 size_t zoom_end = global_zoom_begin+global_zoom_ size-1;394 size_t zoom_end = global_zoom_begin+global_zoom_n-1; 394 395 size_t nZoomCount = 0; 395 396 size_t nbIndex = index.numElements(); … … 517 518 CEventClient event(getType(), EVENT_ID_NON_DISTRIBUTED_VALUE); 518 519 519 int zoom_end = global_zoom_begin + global_zoom_ size- 1;520 int zoom_end = global_zoom_begin + global_zoom_n - 1; 520 521 int nb = 0; 521 522 for (size_t idx = 0; idx < n; ++idx) … … 830 831 msg << this->getId(); 831 832 msg << ni << begin << end; 832 msg << global_zoom_begin << global_zoom_size;833 msg << global_zoom_begin.getValue() << global_zoom_n.getValue(); 833 834 msg << isCompressible_; 834 835 … … 850 851 void CAxis::recvServerAttribut(CBufferIn& buffer) 851 852 { 852 int ni_srv, begin_srv, end_srv, global_zoom_begin_tmp, global_zoom_ size_tmp;853 int ni_srv, begin_srv, end_srv, global_zoom_begin_tmp, global_zoom_n_tmp; 853 854 854 855 buffer >> ni_srv >> begin_srv >> end_srv; 855 buffer >> global_zoom_begin_tmp >> global_zoom_ size_tmp;856 buffer >> global_zoom_begin_tmp >> global_zoom_n_tmp; 856 857 buffer >> isCompressible_; 857 858 global_zoom_begin = global_zoom_begin_tmp; 858 global_zoom_ size = global_zoom_size_tmp;859 int global_zoom_end = global_zoom_begin + global_zoom_ size- 1;859 global_zoom_n = global_zoom_n_tmp; 860 int global_zoom_end = global_zoom_begin + global_zoom_n - 1; 860 861 861 862 zoom_begin_srv = global_zoom_begin > begin_srv ? global_zoom_begin : begin_srv ; -
XIOS/trunk/src/node/axis.hpp
r816 r821 29 29 BEGIN_DECLARE_ATTRIBUTE_MAP(CAxis) 30 30 # include "axis_attribute.conf" 31 # include "axis_attribute_private.conf" 31 32 END_DECLARE_ATTRIBUTE_MAP(CAxis) 32 33 … … 116 117 int zoom_begin_srv, zoom_end_srv, zoom_size_srv; 117 118 int ni_srv, begin_srv, end_srv; 118 int global_zoom_begin, global_zoom_size; // The real global zoom begin and zoom size after axis is transformed (zoomed)119 119 CArray<double,1> value_srv; 120 120 CArray<double,2> bound_srv; -
XIOS/trunk/src/node/domain.cpp
r815 r821 32 32 , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_(), connectedServerRank_() 33 33 , hasBounds(false), hasArea(false), isDistributed_(false), nGlobDomain_(), isCompressible_(false), isUnstructed_(false) 34 , global_zoom_ni(0), global_zoom_ibegin(0), global_zoom_nj(0), global_zoom_jbegin(0)35 34 , isClientAfterTransformationChecked(false), hasLonLat(false) 36 35 , lonvalue_client(), latvalue_client(), bounds_lon_client(), bounds_lat_client() … … 42 41 , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_(), connectedServerRank_() 43 42 , hasBounds(false), hasArea(false), isDistributed_(false), nGlobDomain_(), isCompressible_(false), isUnstructed_(false) 44 , global_zoom_ni(0), global_zoom_ibegin(0), global_zoom_nj(0), global_zoom_jbegin(0)45 43 , isClientAfterTransformationChecked(false), hasLonLat(false) 46 44 , lonvalue_client(), latvalue_client(), bounds_lon_client(), bounds_lat_client() … … 663 661 } 664 662 computeNGlobDomain(); 665 666 if (0 == global_zoom_ni) global_zoom_ni = ni_glo; 667 if (0 == global_zoom_nj) global_zoom_nj = nj_glo; 663 checkZoom(); 664 } 665 666 void CDomain::checkZoom(void) 667 { 668 if (global_zoom_ibegin.isEmpty()) 669 global_zoom_ibegin.setValue(0); 670 if (global_zoom_ni.isEmpty()) 671 global_zoom_ni.setValue(ni_glo); 672 if (global_zoom_jbegin.isEmpty()) 673 global_zoom_jbegin.setValue(0); 674 if (global_zoom_nj.isEmpty()) 675 global_zoom_nj.setValue(nj_glo); 668 676 } 669 677 … … 1253 1261 msg << this->getId() ; 1254 1262 msg << ni_srv << ibegin_srv << iend_srv << nj_srv << jbegin_srv << jend_srv; 1255 msg << global_zoom_ni << global_zoom_ibegin << global_zoom_nj << global_zoom_jbegin;1263 msg << global_zoom_ni.getValue() << global_zoom_ibegin.getValue() << global_zoom_nj.getValue() << global_zoom_jbegin.getValue(); 1256 1264 msg << isCompressible_; 1257 1265 … … 1680 1688 void CDomain::recvServerAttribut(CBufferIn& buffer) 1681 1689 { 1690 int global_zoom_ni_tmp, global_zoom_ibegin_tmp, global_zoom_nj_tmp, global_zoom_jbegin_tmp; 1682 1691 buffer >> ni_srv >> ibegin_srv >> iend_srv >> nj_srv >> jbegin_srv >> jend_srv 1683 >> global_zoom_ni >> global_zoom_ibegin >> global_zoom_nj >> global_zoom_jbegin1692 >> global_zoom_ni_tmp >> global_zoom_ibegin_tmp >> global_zoom_nj_tmp >> global_zoom_jbegin_tmp 1684 1693 >> isCompressible_; 1694 1695 global_zoom_ni.setValue(global_zoom_ni_tmp); 1696 global_zoom_ibegin.setValue(global_zoom_ibegin_tmp); 1697 global_zoom_nj.setValue(global_zoom_nj_tmp); 1698 global_zoom_jbegin.setValue(global_zoom_jbegin_tmp); 1685 1699 1686 1700 int zoom_iend = global_zoom_ibegin + global_zoom_ni - 1; -
XIOS/trunk/src/node/domain.hpp
r809 r821 95 95 bool isCompressible(void) const; 96 96 97 int global_zoom_ibegin, global_zoom_ni;98 int global_zoom_jbegin, global_zoom_nj;99 100 97 int ni_srv,ibegin_srv,iend_srv ; 101 98 int zoom_ni_srv,zoom_ibegin_srv,zoom_iend_srv ; … … 124 121 void sendLonLatArea(void); 125 122 void computeConnectedServer(void) ; 126 127 void AllgatherRectilinearLonLat(CArray<double,1>& lon, CArray<double,1>& lat, 123 124 void AllgatherRectilinearLonLat(CArray<double,1>& lon, CArray<double,1>& lat, 128 125 CArray<double,1>& lon_g, CArray<double,1>& lat_g); 129 130 void fillInRectilinearBoundLonLat(CArray<double,1>& lon, CArray<double,1>& lat, 126 127 void fillInRectilinearBoundLonLat(CArray<double,1>& lon, CArray<double,1>& lat, 131 128 CArray<double,2>& boundsLon, CArray<double,2>& boundsLat); 132 129 void fillInRectilinearLonLat(); … … 170 167 void checkArea(void); 171 168 void checkLonLat(); 169 void checkZoom(void); 172 170 173 171 void checkTransformations(); -
XIOS/trunk/src/node/grid.cpp
r817 r821 262 262 } 263 263 this->isChecked = true; 264 } 265 266 void CGrid::createMask(void) 267 { 268 using namespace std; 269 std::vector<CDomain*> domainP = this->getDomains(); 270 std::vector<CAxis*> axisP = this->getAxis(); 271 int dim = domainP.size() * 2 + axisP.size(); 272 273 std::vector<CArray<bool,1>* > domainMasks(domainP.size()); 274 for (int i = 0; i < domainMasks.size(); ++i) domainMasks[i] = &(domainP[i]->mask_1d); 275 std::vector<CArray<bool,1>* > axisMasks(axisP.size()); 276 for (int i = 0; i < axisMasks.size(); ++i) axisMasks[i] = &(axisP[i]->mask); 277 278 switch (dim) { 279 case 1: 280 checkGridMask(mask_1d, domainMasks, axisMasks, axis_domain_order, true); 281 break; 282 case 2: 283 checkGridMask(mask_2d, domainMasks, axisMasks, axis_domain_order, true); 284 break; 285 case 3: 286 checkGridMask(mask_3d, domainMasks, axisMasks, axis_domain_order, true); 287 break; 288 default: 289 break; 290 } 264 291 } 265 292 -
XIOS/trunk/src/node/grid.hpp
r775 r821 206 206 map<int, CArray<size_t, 1> > outIndexFromClient, compressedOutIndexFromClient; 207 207 void checkMask(void); 208 void createMask(void); 208 209 void modifyMask(const CArray<int,1>& indexToModify); 209 210 … … 217 218 const std::vector<CArray<bool,1>* >& domainMasks, 218 219 const std::vector<CArray<bool,1>* >& axisMasks, 219 const CArray<bool,1>& axisDomainOrder); 220 const CArray<bool,1>& axisDomainOrder, 221 bool createMask = false); 220 222 template<int N> 221 223 void modifyGridMask(CArray<bool,N>& gridMask, const CArray<int,1>& indexToModify); … … 295 297 const std::vector<CArray<bool,1>* >& domainMasks, 296 298 const std::vector<CArray<bool,1>* >& axisMasks, 297 const CArray<bool,1>& axisDomainOrder) 299 const CArray<bool,1>& axisDomainOrder, 300 bool createMask) 298 301 { 299 302 int idx = 0; … … 319 322 } 320 323 321 if (!gridMask.isEmpty() )324 if (!gridMask.isEmpty() && !createMask) 322 325 { 323 326 for (int i = 0; i < dim; ++i) -
XIOS/trunk/src/test/test_new_features.f90
r782 r821 17 17 INTEGER,PARAMETER :: ni_glo=100 18 18 INTEGER,PARAMETER :: nj_glo=100 19 INTEGER,PARAMETER :: llm= 220 INTEGER,PARAMETER :: llmInterPolated= 519 INTEGER,PARAMETER :: llm=5 20 INTEGER,PARAMETER :: llmInterPolated=4 21 21 DOUBLE PRECISION :: lval(llm)=1, tsTemp, lvalInterPolated(llmInterPolated)=1 22 22 TYPE(xios_field) :: field_hdl … … 45 45 46 46 !!! XIOS Initialization (get the local communicator) 47 48 47 CALL xios_initialize(id,return_comm=comm) 49 48 … … 147 146 CALL xios_set_axis_attr("axis_C", n_glo=llm, value=lval) 148 147 CALL xios_set_axis_attr("axis_D", n_glo=llm, begin=axisBegin, n=nAxis, value=lvaln) 149 CALL xios_set_axis_attr("axis_ G", n_glo=llmInterPolated, value=lvalnInterp, begin=axisterpBegin, n=nAxisinterp)148 CALL xios_set_axis_attr("axis_E", n_glo=llmInterPolated, value=lvalnInterp, begin=axisterpBegin, n=nAxisinterp) 150 149 CALL xios_set_domain_attr("domain_A",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, ni=ni,jbegin=jbegin,nj=nj) 151 150 CALL xios_set_domain_attr("domain_A",data_dim=2, data_ibegin=-1, data_ni=ni+2, data_jbegin=-2, data_nj=nj+4) … … 206 205 CALL xios_send_field("field_A",field_A) 207 206 CALL xios_send_field("field_Axis",field_Axis) 208 209 207 CALL xios_send_field("field_Two_Axis",field_Two_Axis) 210 208 CALL xios_send_field("field_All_Axis",field_All_Axis) -
XIOS/trunk/src/transformation/axis_algorithm_zoom.cpp
r787 r821 62 62 { 63 63 axisDest_->global_zoom_begin = zoomBegin_; 64 axisDest_->global_zoom_ size= zoomSize_;64 axisDest_->global_zoom_n = zoomSize_; 65 65 } 66 66 -
XIOS/trunk/src/transformation/domain_algorithm_interpolate.cpp
r809 r821 15 15 #include "netcdf.hpp" 16 16 #include "mapper.hpp" 17 #include "mpi_tag.hpp" 17 18 18 19 namespace xios { … … 95 96 double step=(domainSrc_->lon_end-domainSrc_->lon_start)/domainSrc_->ni_glo ; 96 97 for(int i=0; i<domainSrc_->ni_glo; ++i) lon_g(i)=domainSrc_->lon_start+i*step ; 97 step=(domainSrc_->lat_end-domainSrc_->lat_start)/domainSrc_->nj_glo ; 98 step=(domainSrc_->lat_end-domainSrc_->lat_start)/domainSrc_->nj_glo ; 98 99 for(int i=0; i<domainSrc_->ni_glo; ++i) lat_g(i)=domainSrc_->lat_start+i*step ; 99 100 } … … 160 161 double step=(domainDest_->lon_end-domainDest_->lon_start)/domainDest_->ni_glo ; 161 162 for(int i=0; i<domainDest_->ni_glo; ++i) lon_g(i)=domainDest_->lon_start+i*step ; 162 step=(domainDest_->lat_end-domainDest_->lat_start)/domainDest_->nj_glo ; 163 step=(domainDest_->lat_end-domainDest_->lat_start)/domainDest_->nj_glo ; 163 164 for(int i=0; i<domainDest_->ni_glo; ++i) lat_g(i)=domainDest_->lat_start+i*step ; 164 165 } … … 167 168 if (std::abs(poleValue - std::abs(lat_g(domainDest_->nj_glo-1))) < NumTraits<double>::epsilon()) isSouthPole = true; 168 169 169 170 171 170 171 172 172 173 if (isNorthPole && (0 == domainDest_->jbegin.getValue())) 173 174 { … … 469 470 MPI_INT, 470 471 itMap->first, 471 7,472 MPI_DOMAIN_INTERPOLATION_DEST_INDEX, 472 473 client->intraComm, 473 474 &sendRequest.back()); … … 477 478 MPI_INT, 478 479 itMap->first, 479 8,480 MPI_DOMAIN_INTERPOLATION_SRC_INDEX, 480 481 client->intraComm, 481 482 &sendRequest.back()); … … 485 486 MPI_DOUBLE, 486 487 itMap->first, 487 9,488 MPI_DOMAIN_INTERPOLATION_WEIGHT, 488 489 client->intraComm, 489 490 &sendRequest.back()); … … 504 505 MPI_INT, 505 506 MPI_ANY_SOURCE, 506 7,507 MPI_DOMAIN_INTERPOLATION_DEST_INDEX, 507 508 client->intraComm, 508 509 &recvStatus); … … 516 517 MPI_INT, 517 518 clientSrcRank, 518 8,519 MPI_DOMAIN_INTERPOLATION_SRC_INDEX, 519 520 client->intraComm, 520 521 &recvStatus); … … 524 525 MPI_DOUBLE, 525 526 clientSrcRank, 526 9,527 MPI_DOMAIN_INTERPOLATION_WEIGHT, 527 528 client->intraComm, 528 529 &recvStatus); -
XIOS/trunk/src/transformation/grid_transformation.cpp
r795 r821 18 18 #include "axis_algorithm_transformation.hpp" 19 19 #include "distribution_client.hpp" 20 #include "mpi_tag.hpp" 20 21 21 22 namespace xios { 22 23 CGridTransformation::CGridTransformation(CGrid* destination, CGrid* source) 23 24 : gridSource_(source), gridDestination_(destination), originalGridSource_(source), 24 globalIndexOfCurrentGridSource_(), globalIndexOfOriginalGridSource_(), weightOfGlobalIndexOfOriginalGridSource_(0), algoTypes_() 25 algoTypes_(), nbAlgos_(0), currentGridIndexToOriginalGridIndex_() 26 25 27 { 26 28 //Verify the compatibity between two grids … … 41 43 } 42 44 43 std::vector<CAxis*> axisSrcTmp = gridSource_->getAxis(), axisSrc;44 std::vector<CDomain*> domainSrcTmp = gridSource_->getDomains(), domainSrc;45 for (int idx = 0; idx < axisSrcTmp.size(); ++idx)46 {47 CAxis* axis = CAxis::createAxis();48 axis->axis_ref.setValue(axisSrcTmp[idx]->getId());49 axis->solveRefInheritance(true);50 axis->solveInheritanceTransformation();51 axis->checkAttributesOnClient();52 axisSrc.push_back(axis);53 }54 55 for (int idx = 0; idx < domainSrcTmp.size(); ++idx)56 {57 CDomain* domain = CDomain::createDomain();58 domain->domain_ref.setValue(domainSrcTmp[idx]->getId());59 domain->solveRefInheritance(true);60 domain->solveInheritanceTransformation();61 domain->checkAttributesOnClient();62 domainSrc.push_back(domain);63 }64 65 gridSource_ = CGrid::createGrid(domainSrc, axisSrc, gridDestination_->axis_domain_order);66 gridSource_->computeGridGlobalDimension(domainSrc, axisSrc, gridDestination_->axis_domain_order);45 // std::vector<CAxis*> axisSrcTmp = gridSource_->getAxis(), axisSrc; 46 // std::vector<CDomain*> domainSrcTmp = gridSource_->getDomains(), domainSrc; 47 // for (int idx = 0; idx < axisSrcTmp.size(); ++idx) 48 // { 49 // CAxis* axis = CAxis::createAxis(); 50 // axis->axis_ref.setValue(axisSrcTmp[idx]->getId()); 51 // axis->solveRefInheritance(true); 52 // axis->solveInheritanceTransformation(); 53 // axis->checkAttributesOnClient(); 54 // axisSrc.push_back(axis); 55 // } 56 // 57 // for (int idx = 0; idx < domainSrcTmp.size(); ++idx) 58 // { 59 // CDomain* domain = CDomain::createDomain(); 60 // domain->domain_ref.setValue(domainSrcTmp[idx]->getId()); 61 // domain->solveRefInheritance(true); 62 // domain->solveInheritanceTransformation(); 63 // domain->checkAttributesOnClient(); 64 // domainSrc.push_back(domain); 65 // } 66 // 67 // gridSource_ = CGrid::createGrid(domainSrc, axisSrc, gridDestination_->axis_domain_order); 68 // gridSource_->computeGridGlobalDimension(domainSrc, axisSrc, gridDestination_->axis_domain_order); 67 69 68 70 initializeMappingOfOriginalGridSource(); 69 initializeAlgorithms();71 // initializeAlgorithms(); 70 72 } 71 73 … … 81 83 CContextClient* client = context->client; 82 84 83 CDistributionClient distribution(client->clientRank, originalGridSource_); 84 const std::vector<size_t>& globalIndexGridSrcSendToServer = distribution.getGlobalDataIndexSendToServer(); 85 86 weightOfGlobalIndexOfOriginalGridSource_.resize(globalIndexGridSrcSendToServer.size()); 87 globalIndexOfCurrentGridSource_ = globalIndexGridSrcSendToServer; 88 globalIndexOfOriginalGridSource_ = globalIndexGridSrcSendToServer; 89 weightOfGlobalIndexOfOriginalGridSource_ = 1.0; 85 // Initialize algorithms 86 initializeAlgorithms(); 87 88 ListAlgoType::const_iterator itb = listAlgos_.begin(), 89 ite = listAlgos_.end(), it; 90 91 for (it = itb; it != ite; ++it) 92 { 93 ETranformationType transType = (it->second).first; 94 if (!isSpecialTransformation(transType)) ++nbAlgos_; 95 } 96 97 if (1<nbAlgos_) // Only when there are more than 1 algorithm, will we create temporary grid source 98 { 99 std::vector<CAxis*> axisSrcTmp = gridSource_->getAxis(), axisSrc; 100 std::vector<CDomain*> domainSrcTmp = gridSource_->getDomains(), domainSrc; 101 for (int idx = 0; idx < axisSrcTmp.size(); ++idx) 102 { 103 CAxis* axis = CAxis::createAxis(); 104 axis->axis_ref.setValue(axisSrcTmp[idx]->getId()); 105 axis->solveRefInheritance(true); 106 axis->solveInheritanceTransformation(); 107 axis->checkAttributesOnClient(); 108 axisSrc.push_back(axis); 109 } 110 111 for (int idx = 0; idx < domainSrcTmp.size(); ++idx) 112 { 113 CDomain* domain = CDomain::createDomain(); 114 domain->domain_ref.setValue(domainSrcTmp[idx]->getId()); 115 domain->solveRefInheritance(true); 116 domain->solveInheritanceTransformation(); 117 domain->checkAttributesOnClient(); 118 domainSrc.push_back(domain); 119 } 120 121 gridSource_ = CGrid::createGrid(domainSrc, axisSrc, gridDestination_->axis_domain_order); 122 gridSource_->computeGridGlobalDimension(domainSrc, axisSrc, gridDestination_->axis_domain_order); 123 } 90 124 } 91 125 … … 149 183 } 150 184 } 151 152 153 185 154 186 /*! … … 335 367 break; 336 368 } 369 gridSource_->createMask(); 370 gridSource_->computeGridGlobalDimension(domListSrcP, axisListSrcP, gridSource_->axis_domain_order); 337 371 } 338 372 … … 352 386 ListAlgoType::const_iterator itb = listAlgos_.begin(), 353 387 ite = listAlgos_.end(), it; 388 354 389 CGenericAlgorithmTransformation* algo = 0; 355 390 int nbAgloTransformation = 0; // Only count for executed transformation. Generate domain is a special one, not executed in the list … … 381 416 globaIndexWeightFromDestToSource); 382 417 383 // Compute transformation of global indexes among grids 384 computeTransformationFromOriginalGridSource(globaIndexWeightFromDestToSource); 385 386 // Now grid destination becomes grid source in a new transformation 387 setUpGrid(elementPositionInGrid, transType); 418 if (1 < nbAlgos_) 419 { 420 // Compute transformation of global indexes among grids 421 computeTransformationFromOriginalGridSource(globaIndexWeightFromDestToSource); 422 423 // Now grid destination becomes grid source in a new transformation 424 if (nbAgloTransformation != (nbAlgos_-1)) setUpGrid(elementPositionInGrid, transType); 425 } 426 else 427 { 428 currentGridIndexToOriginalGridIndex_.swap(globaIndexWeightFromDestToSource); 429 } 430 388 431 ++nbAgloTransformation; 389 432 } … … 416 459 iteArr = globalIndexOnClientDest.end(); 417 460 418 // Then find out which index became invalid (become masked after being applied the algorithms, or demande some masked points from grid source) 419 int num = globalIndexOfOriginalGridSource_.size(); 461 GlobalIndexMap::const_iterator iteGlobalMap = currentGridIndexToOriginalGridIndex_.end(); 420 462 const size_t sfmax = NumTraits<unsigned long>::sfmax(); 421 463 int maskIndexNum = 0; 422 for (int idx = 0; idx < num; ++idx) 423 { 424 if (sfmax == globalIndexOfOriginalGridSource_[idx]) 425 { 426 size_t maskedGlobalIndex = globalIndexOfCurrentGridSource_[idx]; 427 itArr = std::find(itbArr, iteArr, maskedGlobalIndex); 428 if (iteArr != itArr) ++maskIndexNum; 464 for (itArr = itbArr; itArr != iteArr; ++itArr) 465 { 466 if (iteGlobalMap != currentGridIndexToOriginalGridIndex_.find(*itArr)) 467 { 468 const std::vector<std::pair<size_t,double> >& vecIndex = currentGridIndexToOriginalGridIndex_[*itArr]; 469 for (int idx = 0; idx < vecIndex.size(); ++idx) 470 { 471 if (sfmax == vecIndex[idx].first) 472 { 473 ++maskIndexNum; 474 break; 475 } 476 } 429 477 } 430 478 } … … 432 480 CArray<int,1> maskIndexToModify(maskIndexNum); 433 481 maskIndexNum = 0; 434 for (int idx = 0; idx < num; ++idx) 435 { 436 if (sfmax == globalIndexOfOriginalGridSource_[idx]) 437 { 438 size_t maskedGlobalIndex = globalIndexOfCurrentGridSource_[idx]; 439 itArr = std::find(itbArr, iteArr, maskedGlobalIndex); 440 if (iteArr != itArr) 482 for (itArr = itbArr; itArr != iteArr; ++itArr) 483 { 484 if (iteGlobalMap != currentGridIndexToOriginalGridIndex_.find(*itArr)) 485 { 486 const std::vector<std::pair<size_t,double> >& vecIndex = currentGridIndexToOriginalGridIndex_[*itArr]; 487 for (int idx = 0; idx < vecIndex.size(); ++idx) 441 488 { 442 int localIdx = std::distance(itbArr, itArr); 443 maskIndexToModify(maskIndexNum) = localMaskIndexOnClientDest[localIdx]; 444 ++maskIndexNum; 489 if (sfmax == vecIndex[idx].first) 490 { 491 int localIdx = std::distance(itbArr, itArr); 492 maskIndexToModify(maskIndexNum) = localMaskIndexOnClientDest[localIdx]; 493 ++maskIndexNum; 494 break; 495 } 445 496 } 446 497 } … … 460 511 CContextClient* client = context->client; 461 512 513 if (currentGridIndexToOriginalGridIndex_.empty()) 514 { 515 currentGridIndexToOriginalGridIndex_ = globaIndexMapFromDestToSource; 516 return; 517 } 518 462 519 CTransformationMapping transformationMap(gridDestination_, gridSource_); 463 520 … … 471 528 std::map<int,std::vector<size_t> >::const_iterator itbSend = globalIndexToSend.begin(), itSend, 472 529 iteSend = globalIndexToSend.end(); 473 std::vector<size_t>::const_iterator itbArr = globalIndexOfCurrentGridSource_.begin(), itArr,474 iteArr = globalIndexOfCurrentGridSource_.end();475 530 int sendBuffSize = 0; 476 531 for (itSend = itbSend; itSend != iteSend; ++itSend) sendBuffSize += (itSend->second).size(); 532 // We use the first element of each block to send number of element in this block 533 sendBuffSize += globalIndexToSend.size(); 534 477 535 478 536 typedef unsigned long Scalar; 479 unsigned long* sendBuff, *currentSendBuff;480 if (0 != sendBuffSize) sendBuff = new unsigned long[sendBuffSize];537 Scalar* sendBuff, *currentSendBuff; 538 if (0 != sendBuffSize) sendBuff = new Scalar [sendBuffSize]; 481 539 for (StdSize idx = 0; idx < sendBuffSize; ++idx) sendBuff[idx] = NumTraits<Scalar>::sfmax(); 482 540 483 std::map<int, MPI_Request> requests; 484 485 std::vector<int> permutIndex(globalIndexOfCurrentGridSource_.size()); 486 typedef XIOSBinarySearchWithIndex<size_t> BinarySearch; 487 XIOSAlgorithms::fillInIndex(globalIndexOfCurrentGridSource_.size(), permutIndex); 488 XIOSAlgorithms::sortWithIndex<size_t, CVectorStorage>(globalIndexOfCurrentGridSource_, permutIndex); 489 BinarySearch searchCurrentSrc(globalIndexOfCurrentGridSource_); 490 std::vector<int>::iterator itbIndex = permutIndex.begin(), itIndex, 491 iteIndex = permutIndex.end(); 492 493 // Find out local index on grid destination (received) 541 std::map<int, MPI_Request> requestsCurrentGrid, requestsOriginalGrid, requestsWeightGrid; 542 GlobalIndexMap::const_iterator iteGlobalIndex = currentGridIndexToOriginalGridIndex_.end(); 543 544 // Only send global index of original source corresponding to non-masked index 545 // Use first position of each block to specify the number of elemnt in this block 546 int globalIndexOriginalSrcSendBuffSize = 0; 494 547 int currentBuffPosition = 0; 495 548 for (itSend = itbSend; itSend != iteSend; ++itSend) … … 497 550 int destRank = itSend->first; 498 551 const std::vector<size_t>& globalIndexOfCurrentGridSourceToSend = itSend->second; 499 int countSize = globalIndexOfCurrentGridSourceToSend.size(); 500 for (int idx = 0; idx < (countSize); ++idx) 552 int countSize = globalIndexOfCurrentGridSourceToSend.size(); 553 size_t countBlock = 0; 554 for (int idx = 0; idx < countSize; ++idx) 501 555 { 502 if (searchCurrentSrc.search(itbIndex, iteIndex, globalIndexOfCurrentGridSourceToSend[idx], itIndex)) 556 size_t index = globalIndexOfCurrentGridSourceToSend[idx]; 557 if (iteGlobalIndex != currentGridIndexToOriginalGridIndex_.find(index))// searchCurrentSrc.search(itbIndex, iteIndex, globalIndexOfCurrentGridSourceToSend[idx], itIndex)) 503 558 { 504 sendBuff[idx+currentBuffPosition] = globalIndexOfOriginalGridSource_[*itIndex]; 559 globalIndexOriginalSrcSendBuffSize += currentGridIndexToOriginalGridIndex_[index].size() + 1; // 1 for number of elements in this block 560 sendBuff[idx+currentBuffPosition+1] = index; 561 countBlock += currentGridIndexToOriginalGridIndex_[index].size() + 1; 505 562 } 506 563 } 564 sendBuff[currentBuffPosition] = countBlock; 507 565 currentSendBuff = sendBuff + currentBuffPosition; 508 MPI_Isend(currentSendBuff, countSize , MPI_UNSIGNED_LONG, destRank, 14, client->intraComm, &requests[destRank]);509 currentBuffPosition += countSize ;566 MPI_Isend(currentSendBuff, countSize +1, MPI_UNSIGNED_LONG, destRank, MPI_GRID_TRANSFORMATION_CURRENT_GRID_INDEX, client->intraComm, &requestsCurrentGrid[destRank]); 567 currentBuffPosition += countSize + 1; 510 568 } 569 570 Scalar* sendOriginalIndexBuff, *currentOriginalIndexSendBuff; 571 if (0 != globalIndexOriginalSrcSendBuffSize) sendOriginalIndexBuff = new Scalar [globalIndexOriginalSrcSendBuffSize]; 572 double* sendOriginalWeightBuff, *currentOriginalWeightSendBuff; 573 if (0 != globalIndexOriginalSrcSendBuffSize) sendOriginalWeightBuff = new double [globalIndexOriginalSrcSendBuffSize]; 574 575 currentBuffPosition = 0; 576 for (itSend = itbSend; itSend != iteSend; ++itSend) 577 { 578 int destRank = itSend->first; 579 const std::vector<size_t>& globalIndexOfCurrentGridSourceToSend = itSend->second; 580 int countSize = globalIndexOfCurrentGridSourceToSend.size(); 581 int increaseStep = 0; 582 for (int idx = 0; idx < countSize; ++idx) 583 { 584 size_t index = globalIndexOfCurrentGridSourceToSend[idx]; 585 if (iteGlobalIndex != currentGridIndexToOriginalGridIndex_.find(index)) 586 { 587 size_t vectorSize = currentGridIndexToOriginalGridIndex_[index].size(); 588 sendOriginalIndexBuff[currentBuffPosition+increaseStep] = vectorSize; 589 sendOriginalWeightBuff[currentBuffPosition+increaseStep] = (double)vectorSize; 590 const std::vector<std::pair<size_t,double> >& indexWeightPair = currentGridIndexToOriginalGridIndex_[index]; 591 for (size_t i = 0; i < vectorSize; ++i) 592 { 593 ++increaseStep; 594 sendOriginalIndexBuff[currentBuffPosition+increaseStep] = indexWeightPair[i].first; 595 sendOriginalWeightBuff[currentBuffPosition+increaseStep] = indexWeightPair[i].second; 596 } 597 ++increaseStep; 598 } 599 } 600 601 currentOriginalIndexSendBuff = sendOriginalIndexBuff + currentBuffPosition; 602 currentOriginalWeightSendBuff = sendOriginalWeightBuff + currentBuffPosition; 603 if (0 != increaseStep) 604 { 605 MPI_Isend(currentOriginalIndexSendBuff, increaseStep, MPI_UNSIGNED_LONG, destRank, MPI_GRID_TRANSFORMATION_ORIGINAL_GRID_INDEX, client->intraComm, &requestsOriginalGrid[destRank]); 606 MPI_Isend(currentOriginalWeightSendBuff, increaseStep, MPI_DOUBLE, destRank, MPI_GRID_TRANSFORMATION_ORIGINAL_GRID_WEIGHT, client->intraComm, &requestsWeightGrid[destRank]); 607 } 608 currentBuffPosition += increaseStep; 609 } 610 511 611 512 612 // Receiving global index of grid source sending from current grid source … … 515 615 int recvBuffSize = 0; 516 616 for (itRecv = itbRecv; itRecv != iteRecv; ++itRecv) recvBuffSize += (itRecv->second).size(); 517 518 unsigned long* recvBuff, *currentRecvBuff; 519 if (0 != recvBuffSize) recvBuff = new unsigned long [recvBuffSize]; 617 recvBuffSize += globalIndexToReceive.size(); 618 619 Scalar* recvBuff, *currentRecvBuff; 620 if (0 != recvBuffSize) recvBuff = new Scalar [recvBuffSize]; 520 621 for (StdSize idx = 0; idx < recvBuffSize; ++idx) recvBuff[idx] = NumTraits<Scalar>::sfmax(); 521 622 623 std::map<int,int> countBlockMap; 624 int globalIndexOriginalSrcRecvBuffSize = 0; 522 625 int currentRecvBuffPosition = 0; 523 626 for (itRecv = itbRecv; itRecv != iteRecv; ++itRecv) … … 527 630 int countSize = (itRecv->second).size(); 528 631 currentRecvBuff = recvBuff + currentRecvBuffPosition; 529 MPI_Recv(currentRecvBuff, countSize, MPI_UNSIGNED_LONG, srcRank, 14, client->intraComm, &status); 530 currentRecvBuffPosition += countSize; 632 MPI_Recv(currentRecvBuff, countSize +1, MPI_UNSIGNED_LONG, srcRank, MPI_GRID_TRANSFORMATION_CURRENT_GRID_INDEX, client->intraComm, &status); 633 globalIndexOriginalSrcRecvBuffSize += *currentRecvBuff; 634 countBlockMap[srcRank] = *currentRecvBuff; 635 currentRecvBuffPosition += countSize +1; 531 636 } 532 637 533 int nbCurrentGridSource = 0; 638 Scalar* recvOriginalIndexBuff, *currentOriginalIndexRecvBuff; 639 if (0 != globalIndexOriginalSrcRecvBuffSize) recvOriginalIndexBuff = new Scalar [globalIndexOriginalSrcRecvBuffSize]; 640 double* recvOriginalWeightBuff, *currentOriginalWeightRecvBuff; 641 if (0 != globalIndexOriginalSrcRecvBuffSize) recvOriginalWeightBuff = new double [globalIndexOriginalSrcRecvBuffSize]; 642 643 int countBlock = 0; 644 currentRecvBuffPosition = 0; 645 currentBuffPosition = 0; 534 646 for (itRecv = itbRecv; itRecv != iteRecv; ++itRecv) 535 647 { 536 int ssize = (itRecv->second).size(); 537 for (int idx = 0; idx < ssize; ++idx) 648 MPI_Status statusIndex, statusWeight; 649 int srcRank = itRecv->first; 650 countBlock = countBlockMap[srcRank]; 651 currentOriginalIndexRecvBuff = recvOriginalIndexBuff + currentBuffPosition; 652 currentOriginalWeightRecvBuff = recvOriginalWeightBuff + currentBuffPosition; 653 if (0 != countBlock) 538 654 { 539 nbCurrentGridSource += (itRecv->second)[idx].size(); 655 MPI_Recv(currentOriginalIndexRecvBuff, countBlock, MPI_UNSIGNED_LONG, srcRank, MPI_GRID_TRANSFORMATION_ORIGINAL_GRID_INDEX, client->intraComm, &statusIndex); 656 MPI_Recv(currentOriginalWeightRecvBuff, countBlock, MPI_DOUBLE, srcRank, MPI_GRID_TRANSFORMATION_ORIGINAL_GRID_WEIGHT, client->intraComm, &statusWeight); 657 } 658 currentBuffPosition += countBlock; 659 } 660 661 // We process everything in here, even case of masked index 662 // The way to process masked index needs discussing 663 const size_t sfmax = NumTraits<unsigned long>::sfmax(); 664 GlobalIndexMap currentToOriginalTmp; 665 666 currentRecvBuffPosition = 0; 667 currentRecvBuff = recvBuff; 668 currentOriginalIndexRecvBuff = recvOriginalIndexBuff; 669 currentOriginalWeightRecvBuff = recvOriginalWeightBuff; 670 for (itRecv = itbRecv; itRecv != iteRecv; ++itRecv) 671 { 672 int countBlockRank = countBlockMap[itRecv->first]; 673 674 ++currentRecvBuff; // it's very subtle here, pay attention 675 int countSize = (itRecv->second).size(); 676 for (int idx = 0; idx < countSize; ++idx) 677 { 678 ++currentRecvBuff; 679 int ssize = (itRecv->second)[idx].size(); 680 if (sfmax != *currentRecvBuff) 681 { 682 if (0 != countBlockRank) 683 { 684 countBlock = *(currentOriginalIndexRecvBuff+currentRecvBuffPosition); 685 for (int i = 0; i < ssize; ++i) 686 { 687 for (int j = 0; j < countBlock; ++j) 688 { 689 size_t globalOriginalIndex = *(currentOriginalIndexRecvBuff+currentRecvBuffPosition+j+1); 690 double weightGlobal = *(currentOriginalWeightRecvBuff+currentRecvBuffPosition+j+1) * (itRecv->second)[idx][i].second; 691 currentToOriginalTmp[(itRecv->second)[idx][i].first].push_back(make_pair(globalOriginalIndex,weightGlobal)); 692 } 693 } 694 currentRecvBuffPosition += countBlock+1; 695 } 696 } 697 // else 698 // { 699 // for (int i = 0; i < ssize; ++i) 700 // { 701 // currentToOriginalTmp[(itRecv->second)[idx][i].first].push_back(make_pair(sfmax,1.0)); 702 // } 703 // } 540 704 } 541 705 } 542 706 543 if (globalIndexOfCurrentGridSource_.size() != nbCurrentGridSource) 544 { 545 globalIndexOfCurrentGridSource_.resize(nbCurrentGridSource); 546 globalIndexOfOriginalGridSource_.resize(nbCurrentGridSource); 547 weightOfGlobalIndexOfOriginalGridSource_.resize(nbCurrentGridSource); 548 } 549 550 int k = 0; 551 currentRecvBuff = recvBuff; 552 for (itRecv = itbRecv; itRecv != iteRecv; ++itRecv) 553 { 554 int countSize = (itRecv->second).size(); 555 for (int idx = 0; idx < countSize; ++idx, ++currentRecvBuff) 556 { 557 int ssize = (itRecv->second)[idx].size(); 558 for (int i = 0; i < ssize; ++i) 559 { 560 globalIndexOfCurrentGridSource_[k] = ((itRecv->second)[idx][i]).first; 561 weightOfGlobalIndexOfOriginalGridSource_(k) = ((itRecv->second)[idx][i]).second; 562 globalIndexOfOriginalGridSource_[k] = *currentRecvBuff; 563 ++k; 564 } 565 } 566 } 707 currentGridIndexToOriginalGridIndex_.swap(currentToOriginalTmp); 567 708 568 709 std::map<int, MPI_Request>::iterator itRequest; 569 for (itRequest = requests.begin(); itRequest != requests.end(); ++itRequest) 710 for (itRequest = requestsCurrentGrid.begin(); itRequest != requestsCurrentGrid.end(); ++itRequest) 711 MPI_Wait(&itRequest->second, MPI_STATUS_IGNORE); 712 for (itRequest = requestsOriginalGrid.begin(); itRequest != requestsOriginalGrid.end(); ++itRequest) 713 MPI_Wait(&itRequest->second, MPI_STATUS_IGNORE); 714 for (itRequest = requestsWeightGrid.begin(); itRequest != requestsWeightGrid.end(); ++itRequest) 570 715 MPI_Wait(&itRequest->second, MPI_STATUS_IGNORE); 571 716 572 717 if (0 != sendBuffSize) delete [] sendBuff; 573 718 if (0 != recvBuffSize) delete [] recvBuff; 719 if (0 != globalIndexOriginalSrcSendBuffSize) delete [] sendOriginalIndexBuff; 720 if (0 != globalIndexOriginalSrcSendBuffSize) delete [] sendOriginalWeightBuff; 721 if (0 != globalIndexOriginalSrcRecvBuffSize) delete [] recvOriginalIndexBuff; 722 if (0 != globalIndexOriginalSrcRecvBuffSize) delete [] recvOriginalWeightBuff; 574 723 } 575 724 … … 586 735 CTransformationMapping transformationMap(gridDestination_, originalGridSource_); 587 736 588 std::map<size_t, std::vector<std::pair<size_t,double> > > globaIndexWeightFromDestToSource; 589 int nb = globalIndexOfCurrentGridSource_.size(); 590 const size_t sfmax = NumTraits<unsigned long>::sfmax(); 591 for (int idx = 0; idx < nb; ++idx) 592 { 593 if (sfmax != globalIndexOfOriginalGridSource_[idx]) 594 globaIndexWeightFromDestToSource[globalIndexOfCurrentGridSource_[idx]].push_back(make_pair(globalIndexOfOriginalGridSource_[idx], weightOfGlobalIndexOfOriginalGridSource_(idx))) ; 595 } 596 597 // Then compute transformation mapping among clients 598 transformationMap.computeTransformationMapping(globaIndexWeightFromDestToSource); 737 transformationMap.computeTransformationMapping(currentGridIndexToOriginalGridIndex_); 599 738 600 739 const std::map<int,std::vector<std::vector<std::pair<size_t,double> > > >& globalIndexToReceive = transformationMap.getGlobalIndexReceivedOnGridDestMapping(); … … 667 806 } 668 807 808 bool CGridTransformation::isSpecialTransformation(ETranformationType transType) 809 { 810 bool res; 811 switch (transType) 812 { 813 case TRANS_GENERATE_RECTILINEAR_DOMAIN: 814 res = true; 815 break; 816 default: 817 res = false; 818 break; 819 } 820 821 return res; 822 } 823 669 824 /*! 670 825 Local index of data which need sending from the grid source -
XIOS/trunk/src/transformation/grid_transformation.hpp
r790 r821 63 63 void computeTransformationFromOriginalGridSource(const std::map<size_t, std::vector<std::pair<size_t,double> > >& globaIndexMapFromDestToSource); 64 64 void updateFinalGridDestination(); 65 bool isSpecialTransformation(ETranformationType transType); 65 66 66 67 protected: … … 77 78 //! List of algorithm types and their order 78 79 ListAlgoType listAlgos_; 80 81 //! Number of algorithm 82 int nbAlgos_; 83 84 typedef std::map<size_t, std::vector<std::pair<size_t,double> > > GlobalIndexMap; 85 79 86 // true if domain algorithm and false if axis algorithm (can be replaced by tuple with listAlgos_ 80 87 std::vector<bool> algoTypes_; … … 96 103 97 104 //! (Grid) Global index of grid source 98 std::vector<size_t> globalIndexOfCurrentGridSource_; 99 std::vector<size_t> globalIndexOfOriginalGridSource_; 100 CArray<double,1> weightOfGlobalIndexOfOriginalGridSource_; 105 GlobalIndexMap currentGridIndexToOriginalGridIndex_; 101 106 }; 102 107
Note: See TracChangeset
for help on using the changeset viewer.