Changeset 624 for XIOS/trunk/src/transformation
- Timestamp:
- 06/22/15 13:36:37 (9 years ago)
- Location:
- XIOS/trunk/src/transformation
- Files:
-
- 1 added
- 12 moved
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/transformation/axis_algorithm_inverse.cpp
r623 r624 1 /*! 2 \file axis_algorithm_inverse.hpp 3 \author Ha NGUYEN 4 \since 14 May 2015 5 \date 09 June 2015 6 7 \brief Algorithm for inversing an axis.. 8 */ 1 9 #include "axis_algorithm_inverse.hpp" 2 10 -
XIOS/trunk/src/transformation/axis_algorithm_inverse.hpp
r623 r624 1 /*! 2 \file axis_algorithm_inverse.hpp 3 \author Ha NGUYEN 4 \since 14 May 2015 5 \date 09 June 2015 6 7 \brief Algorithm for inversing an axis.. 8 */ 1 9 #ifndef __XIOS_AXIS_ALGORITHM_INVERSE_HPP__ 2 10 #define __XIOS_AXIS_ALGORITHM_INVERSE_HPP__ … … 6 14 7 15 namespace xios { 8 16 /*! 17 \class CAxisAlgorithmInverse 18 Inversing an axis 19 */ 9 20 class CAxisAlgorithmInverse : public CAxisAlgorithmTransformation 10 21 { -
XIOS/trunk/src/transformation/axis_algorithm_transformation.cpp
r623 r624 1 /*! 2 \file axis_algorithm_transformation.hpp 3 \author Ha NGUYEN 4 \since 14 May 2015 5 \date 09 June 2015 6 7 \brief Interface for all axis transformation algorithms. 8 */ 9 1 10 #include "axis_algorithm_transformation.hpp" 2 #include "axis_ inverse.hpp"3 #include "axis_ zoom.hpp"11 #include "axis_algorithm_inverse.hpp" 12 #include "axis_algorithm_zoom.hpp" 4 13 5 14 namespace xios { … … 8 17 : CGenericAlgorithmTransformation() 9 18 { 10 // if (axisDestination->size.getValue() != axisSource->size.getValue())11 // {12 // ERROR("CAxisZoom::CAxisZoom(CAxis* axisDestination, CAxis* axisSource)",13 // << "Two axis have different size"14 // << "Size of axis source " <<axisSource->getId() << " is " << axisSource->size.getValue() << std::endl15 // << "Size of axis destionation " <<axisDestination->getId() << " is " << axisDestination->size.getValue());16 // }17 //18 //19 // axisDestGlobalSize_ = axisDestination->size.getValue();20 // int niDest = axisDestination->ni.getValue();21 // int ibeginDest = axisDestination->ibegin.getValue();22 //23 // for (int idx = 0; idx < niDest; ++idx) axisDestGlobalIndex_.push_back(ibeginDest+idx);24 19 } 25 20 26 21 CAxisAlgorithmTransformation::~CAxisAlgorithmTransformation() 27 22 { 28 // for (int idx = 0; idx < algosOfAnAxis_.size(); ++idx) delete algosOfAnAxis_[idx];29 23 } 30 24 31 25 void CAxisAlgorithmTransformation::computeIndexSourceMapping() 32 26 { 33 // if (!algosOfAnAxis_.empty())34 // {35 // algosOfAnAxis_[0]->computeIndexSourceMapping(this->transformationMapping_);36 // for (int idx = 1; idx < algosOfAnAxis_.size(); ++idx)37 // {38 // algosOfAnAxis_[idx]->computeIndexSourceMapping(algosOfAnAxis_[idx-1]->getTransformationMapping());39 // }40 // this->transformationMapping_ = algosOfAnAxis_[algosOfAnAxis_.size()-1]->getTransformationMapping();41 // }42 27 } 43 28 … … 162 147 } 163 148 } 164 165 166 149 } -
XIOS/trunk/src/transformation/axis_algorithm_transformation.hpp
r623 r624 1 /*! 2 \file axis_algorithm_transformation.hpp 3 \author Ha NGUYEN 4 \since 14 May 2015 5 \date 09 June 2015 6 7 \brief Interface for all axis transformation algorithms. 8 */ 1 9 #ifndef __XIOS_AXIS_ALGORITHM_TRANSFORMATION_HPP__ 2 10 #define __XIOS_AXIS_ALGORITHM_TRANSFORMATION_HPP__ … … 4 12 #include "generic_algorithm_transformation.hpp" 5 13 #include "axis.hpp" 6 #include "concrete_algo.hpp"7 14 8 15 namespace xios { 9 16 17 /*! 18 \class CAxisAlgorithmTransformation 19 Algorithms for axis. 20 */ 10 21 class CAxisAlgorithmTransformation : public virtual CGenericAlgorithmTransformation 11 22 { … … 24 35 std::vector<CArray<size_t,1> >& globalIndexSrcGrid); 25 36 void computeIndexSourceMapping(); 37 26 38 protected: 39 //! Global index of an axis on grid destination 27 40 std::vector<int> axisDestGlobalIndex_; 41 42 //! Size of 28 43 int axisDestGlobalSize_; 29 44 -
XIOS/trunk/src/transformation/axis_algorithm_zoom.cpp
r623 r624 1 /*! 2 \file axis_algorithm_zoom.cpp 3 \author Ha NGUYEN 4 \since 03 June 2015 5 \date 12 June 2015 6 7 \brief Algorithm for zooming on an axis. 8 */ 1 9 #include "axis_algorithm_zoom.hpp" 2 10 … … 22 30 } 23 31 32 /*! 33 Compute the index mapping between axis on grid source and one on grid destination 34 */ 24 35 void CAxisAlgorithmZoom::computeIndexSourceMapping() 25 36 { … … 43 54 } 44 55 56 /*! 57 After a zoom on axis, it should be certain that (global) zoom begin and (global) zoom size are updated 58 */ 45 59 void CAxisAlgorithmZoom::updateZoom() 46 60 { … … 49 63 } 50 64 65 /*! 66 Update mask on axis 67 Because only zoomed region on axis is not masked, the remaining must be masked to make sure 68 correct index be extracted 69 */ 51 70 void CAxisAlgorithmZoom::updateAxisDestinationMask() 52 71 { -
XIOS/trunk/src/transformation/axis_algorithm_zoom.hpp
r623 r624 1 /*! 2 \file axis_algorithm_zoom.hpp 3 \author Ha NGUYEN 4 \since 03 June 2015 5 \date 12 June 2015 6 7 \brief Algorithm for zooming on an axis. 8 */ 1 9 #ifndef __XIOS_AXIS_ALGORITHM_ZOOM_HPP__ 2 10 #define __XIOS_AXIS_ALGORITHM_ZOOM_HPP__ … … 7 15 8 16 namespace xios { 9 17 /*! 18 \class CAxisAlgorithmZoom 19 Implementing zoom on axis 20 A zoomed region can be considered as region that isnt masked. 21 Only this zoomed region is extracted to write on Netcdf. 22 */ 10 23 class CAxisAlgorithmZoom : public CAxisAlgorithmTransformation 11 24 { … … 20 33 void updateAxisDestinationMask(); 21 34 void updateZoom(); 35 22 36 private: 37 //! Global zoom begin on axis 23 38 StdSize zoomBegin_; 39 40 //! Global zoom end on axis 24 41 StdSize zoomEnd_; 42 43 //! Global zoom size on axis 25 44 StdSize zoomSize_; 26 45 27 46 private: 47 //! Axis on grid destination 28 48 CAxis* axisDest_; 49 50 //! Axis on grid source 29 51 CAxis* axisSrc_; 30 52 }; -
XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp
r623 r624 1 /*! 2 \file generic_algorithm_transformation.hpp 3 \author Ha NGUYEN 4 \since 14 May 2015 5 \date 09 June 2015 6 7 \brief Interface for all transformation algorithms. 8 */ 1 9 #include "generic_algorithm_transformation.hpp" 2 10 … … 26 34 iteTransMap = transformationMapping_.end(); 27 35 std::vector<int>::const_iterator itbVec, itVec, iteVec; 28 std::vector<CArray<size_t,1> > globalIndexSrcGrid ((itTransMap->second).size());36 std::vector<CArray<size_t,1> > globalIndexSrcGrid; //((itTransMap->second).size()); 29 37 CArray<size_t,1> globalIndexDestGrid; 30 31 38 for (itTransMap = itbTransMap; itTransMap != iteTransMap; ++itTransMap) 32 39 { 40 33 41 this->computeGlobalIndexFromGlobalIndexElement(itTransMap->first, 34 42 itTransMap->second, -
XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp
r623 r624 1 /*! 2 \file generic_algorithm_transformation.hpp 3 \author Ha NGUYEN 4 \since 14 May 2015 5 \date 09 June 2015 6 7 \brief Interface for all transformation algorithms. 8 */ 1 9 #ifndef __XIOS_GENERIC_ALGORITHM_TRANSFORMATION_HPP__ 2 10 #define __XIOS_GENERIC_ALGORITHM_TRANSFORMATION_HPP__ … … 7 15 8 16 namespace xios { 9 17 /*! 18 \class CGenericAlgorithmTransformation 19 This class defines the interface for all other inherted algorithms class 20 */ 10 21 class CGenericAlgorithmTransformation 11 22 { -
XIOS/trunk/src/transformation/grid_transformation.cpp
r623 r624 3 3 \author Ha NGUYEN 4 4 \since 14 May 2015 5 \date 09June 20155 \date 18 June 2015 6 6 7 7 \brief Interface for all transformations. … … 62 62 } 63 63 64 /*! 65 Initialize the mapping between the first grid source and the original one 66 In a series of transformation, for each step, there is a need to "create" a new grid that plays a role of "temporary" source. 67 Because at the end of the series, we need to know about the index mapping between the final grid destination and original grid source, 68 for each transformation, we need to make sure that the current "temporary source" maps its global index correctly to the original one. 69 */ 64 70 void CGridTransformation::initializeMappingOfOriginalGridSource() 65 71 { … … 100 106 } 101 107 108 /*! 109 Initialize the algorithms (transformations) 110 */ 102 111 void CGridTransformation::initializeAlgorithms() 103 112 { … … 154 163 } 155 164 165 /*! 166 Select algorithm correspoding to its transformation type and its position in each element 167 \param [in] elementPositionInGrid position of element in grid. e.g: a grid has 1 domain and 1 axis, then position of domain is 1 (because it contains 2 basic elements) 168 and position of axis is 2 169 \param [in] transType transformation type, for now we have Zoom_axis, inverse_axis 170 \param [in] transformationOrder position of the transformation in an element (an element can have several transformation) 171 */ 156 172 void CGridTransformation::selectAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder) 157 173 { … … 159 175 } 160 176 177 /*! 178 Select algorithm of an axis correspoding to its transformation type and its position in each element 179 \param [in] elementPositionInGrid position of element in grid. e.g: a grid has 1 domain and 1 axis, then position of domain is 1 (because it contains 2 basic elements) 180 and position of axis is 2 181 \param [in] transType transformation type, for now we have Zoom_axis, inverse_axis 182 \param [in] transformationOrder position of the transformation in an element (an element can have several transformation) 183 */ 161 184 void CGridTransformation::selectAxisAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder) 162 185 { … … 188 211 } 189 212 213 /*! 214 Select algorithm of a domain correspoding to its transformation type and its position in each element 215 \param [in] elementPositionInGrid position of element in grid. e.g: a grid has 1 domain and 1 axis, then position of domain is 1 (because it contains 2 basic elements) 216 and position of axis is 2 217 \param [in] transType transformation type, for now we have Zoom_axis, inverse_axis 218 \param [in] transformationOrder position of the transformation in an element (an element can have several transformation) 219 */ 190 220 void CGridTransformation::selectDomainAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder) 191 221 { 192 193 } 194 222 } 223 224 /*! 225 Assign the current grid destination to the grid source in the new transformation. 226 The current grid destination plays the role of grid source in next transformation (if any). 227 Only element on which the transformation is performed is modified 228 \param [in] elementPositionInGrid position of element in grid 229 \param [in] transType transformation type 230 */ 195 231 void CGridTransformation::setUpGrid(int elementPositionInGrid, ETranformationType transType) 196 232 { … … 211 247 } 212 248 249 /*! 250 Perform all transformations 251 For each transformation, there are some things to do: 252 -) Chose the correct algorithm by transformation type and position of element 253 -) Calculate the mapping of global index between the current grid source and grid destination 254 -) Calculate the mapping of global index between current grid DESTINATION and ORIGINAL grid SOURCE 255 -) Make current grid destination become grid source in the next transformation 256 */ 213 257 void CGridTransformation::computeAll() 214 258 { … … 234 278 const CArray<size_t,1>& globalIndexGridDestSendToServer = distributionClientDest.getGlobalDataIndexSendToServer(); 235 279 236 std::cout << "global index grid dest send to server " << globalIndexGridDestSendToServer << std::endl;237 280 // ComputeTransformation of global index of each element 238 281 std::vector<int> gridDestinationDimensionSize = gridDestination_->getGlobalDimension(); … … 250 293 } 251 294 252 std::cout << "global index destination 0 final " << *globalIndexOfCurrentGridSource_ << std::endl;253 std::cout << "global index destination 1 final " << *globalIndexOfOriginalGridSource_ << std::endl;254 295 updateFinalGridDestination(); 255 296 computeFinalTransformationMapping(); … … 269 310 CDistributionClient distributionClientDest(client->clientRank, gridDestination_); 270 311 const CArray<int, 1>& localMaskIndexOnClientDest = distributionClientDest.getLocalMaskIndexOnClient(); 271 std::cout << "local mask " << localMaskIndexOnClientDest << std::endl;272 273 312 const CArray<size_t,1>& globalIndexOnClientDest = distributionClientDest.getGlobalDataIndexSendToServer(); 274 std::cout << "global index " << globalIndexOnClientDest << std::endl; 313 275 314 CArray<size_t, 1>::const_iterator itbArr, itArr, iteArr; 276 315 itbArr = globalIndexOnClientDest.begin(); … … 308 347 } 309 348 310 std::cout << "index to modify " << *maskIndexToModify << std::endl;311 349 gridDestination_->modifyMask(*maskIndexToModify); 312 350 … … 339 377 int sendBuffSize = 0; 340 378 for (itSend = itbSend; itSend != iteSend; ++itSend) sendBuffSize += (itSend->second).size(); 341 342 std::cout << "global index destination 0 before" << *globalIndexOfCurrentGridSource_ << std::endl;343 std::cout << "global index destination 1 before" << *globalIndexOfOriginalGridSource_ << std::endl;344 379 345 380 typedef unsigned long Scalar; … … 401 436 if (globalIndexOfCurrentGridSource_->numElements() != nbCurrentGridSource) 402 437 { 403 if ((0 != nbCurrentGridSource) && (0 != globalIndexOfCurrentGridSource_)) 404 { 405 delete globalIndexOfCurrentGridSource_; 406 globalIndexOfCurrentGridSource_ = new CArray<size_t,1>(nbCurrentGridSource); 407 } 438 delete globalIndexOfCurrentGridSource_; 439 globalIndexOfCurrentGridSource_ = new CArray<size_t,1>(nbCurrentGridSource); 408 440 } 409 441 410 442 if (globalIndexOfOriginalGridSource_->numElements() != nbCurrentGridSource) 411 443 { 412 if ((0 != nbCurrentGridSource) && (0 != globalIndexOfOriginalGridSource_)) 413 { 414 delete globalIndexOfOriginalGridSource_; 415 globalIndexOfOriginalGridSource_ = new CArray<size_t,1>(nbCurrentGridSource); 416 } 444 delete globalIndexOfOriginalGridSource_; 445 globalIndexOfOriginalGridSource_ = new CArray<size_t,1>(nbCurrentGridSource); 417 446 } 418 447 … … 434 463 } 435 464 436 std::cout << "global index destination 0 after " << *globalIndexOfCurrentGridSource_ << std::endl;437 std::cout << "global index destination 1 after " << *globalIndexOfOriginalGridSource_ << std::endl;438 465 if (0 != sendBuffSize) delete [] sendBuff; 439 466 if (0 != recvBuffSize) delete [] recvBuff; … … 475 502 const CArray<size_t,1>& globalIndexOnClientDest = distributionClientDest.getGlobalDataIndexSendToServer(); //gridDestination_->getDistributionClient()->getGlobalDataIndexSendToServer(); 476 503 477 std::cout << "dest: local index " << localIndexOnClientDest << std::endl;478 std::cout << "dest: global index " << globalIndexOnClientDest << std::endl;479 504 const CArray<int, 1>& localIndexOnClientSrc = distributionClientSrc.getLocalDataIndexOnClient(); //gridSource_->getDistributionClient()->getLocalDataIndexOnClient(); 480 505 const CArray<size_t,1>& globalIndexOnClientSrc = distributionClientSrc.getGlobalDataIndexSendToServer(); //gridSource_->getDistributionClient()->getGlobalDataIndexSendToServer(); 481 std::cout << "src: local index " << localIndexOnClientSrc << std::endl; 482 std::cout << "src: global index " << globalIndexOnClientSrc << std::endl; 506 483 507 std::vector<size_t>::const_iterator itbVec, itVec, iteVec; 484 508 CArray<size_t, 1>::const_iterator itbArr, itArr, iteArr; … … 506 530 { 507 531 int localIdx = std::distance(itbArr, itArr); 508 (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = localIndexOnClientDest(localIdx); // Local index of un-extracted data (only domain)509 //(*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = (localIdx); // Local index of extracted data532 // (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = localIndexOnClientDest(localIdx); // Local index of un-extracted data (only domain) 533 (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = (localIdx); // Local index of extracted data 510 534 } 511 535 } 512 536 } 513 // std::cout << "local index to receive from source Rank = " << sourceRank << (*localIndexToReceiveOnGridDest_[sourceRank][i]) << std::endl;514 537 } 515 538 … … 536 559 } 537 560 } 538 std::cout << "local index to send to dest Rank = " << destRank << (*localIndexToSendFromGridSource_[destRank]) << std::endl;539 561 } 540 562 } … … 544 566 \return local index of data 545 567 */ 546 std::map<int, CArray<int,1>* > CGridTransformation::getLocalIndexToSendFromGridSource() 568 const std::map<int, CArray<int,1>* >& CGridTransformation::getLocalIndexToSendFromGridSource() const 547 569 { 548 570 return localIndexToSendFromGridSource_; … … 553 575 \return local index of data 554 576 */ 555 std::map<int, std::vector<CArray<int,1>* > > CGridTransformation::getLocalIndexToReceiveOnGridDest() 577 const std::map<int, std::vector<CArray<int,1>* > >& CGridTransformation::getLocalIndexToReceiveOnGridDest() const 556 578 { 557 579 return localIndexToReceiveOnGridDest_; -
XIOS/trunk/src/transformation/grid_transformation.hpp
r623 r624 3 3 \author Ha NGUYEN 4 4 \since 14 May 2015 5 \date 09June 20155 \date 18 June 2015 6 6 7 7 \brief Interface for all transformations. … … 40 40 void computeAll(); 41 41 42 43 std::map<int, CArray<int,1>* > getLocalIndexToSendFromGridSource(); 44 std::map<int, std::vector<CArray<int,1>* > > getLocalIndexToReceiveOnGridDest(); 42 const std::map<int, CArray<int,1>* >& getLocalIndexToSendFromGridSource() const; 43 const std::map<int, std::vector<CArray<int,1>* > >& getLocalIndexToReceiveOnGridDest() const; 45 44 46 45 private: -
XIOS/trunk/src/transformation/transformation_mapping.cpp
r623 r624 3 3 \author Ha NGUYEN 4 4 \since 14 May 2015 5 \date 09June 20155 \date 18 June 2015 6 6 7 7 \brief Take charge of communication among clients to exchange transformed data. … … 33 33 } 34 34 35 std::cout << "global index grid src " << globalIndexGridSrc << std::endl;36 35 gridIndexClientClientMapping_ = new CClientServerMappingDistributed(globalIndexOfServer, 37 36 client->intraComm, -
XIOS/trunk/src/transformation/transformation_mapping.hpp
r623 r624 47 47 //! Mapping of client rank of grid destination and global index to send from grid source 48 48 std::map<int,std::vector<size_t> > globalIndexSendToGridDestMapping_; 49 50 49 }; 51 50
Note: See TracChangeset
for help on using the changeset viewer.