Changeset 1642 for XIOS/dev/branch_openmp/src/filter
- Timestamp:
- 01/23/19 10:31:44 (5 years ago)
- Location:
- XIOS/dev/branch_openmp/src/filter
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/src/filter/file_writer_filter.cpp
r1482 r1642 17 17 void CFileWriterFilter::onInputReady(std::vector<CDataPacketPtr> data) 18 18 { 19 const bool detectMissingValue = ( !field->detect_missing_value.isEmpty()20 && !field->default_value.isEmpty()21 && field->detect_missing_value == true);19 const bool detectMissingValue = ( !field->default_value.isEmpty() && 20 ( (!field->detect_missing_value.isEmpty() || field->detect_missing_value == true) 21 || field->hasGridMask()) ); 22 22 23 23 CArray<double, 1> dataArray = (detectMissingValue) ? data[0]->data.copy() : data[0]->data; -
XIOS/dev/branch_openmp/src/filter/source_filter.cpp
r1460 r1642 7 7 namespace xios 8 8 { 9 CSourceFilter::CSourceFilter(CGarbageCollector& gc, CGrid* grid, bool compression, 9 CSourceFilter::CSourceFilter(CGarbageCollector& gc, CGrid* grid, 10 bool compression /*= true*/, bool mask /*= false*/, 10 11 const CDuration offset /*= NoneDu*/, bool manualTrigger /*= false*/, 11 12 bool hasMissingValue /*= false*/, … … 14 15 , grid(grid) 15 16 , compression(compression) 17 , mask(mask) 16 18 , offset(offset) 17 19 , hasMissingValue(hasMissingValue), defaultValue(defaultValue) … … 40 42 } 41 43 else 42 grid->inputField(data, packet->data); 43 44 45 46 // if (compression) grid->inputField(data, packet->data) ; 47 // else 48 // { 49 // // just make a flat copy 50 // CArray<double, N> data_tmp(data.copy()) ; // supress const attribute 51 // CArray<double,1> dataTmp2(data_tmp.dataFirst(),shape(data.numElements()),neverDeleteData) ; 52 // packet->data = dataTmp2 ; 53 // } 44 { 45 if (mask) 46 grid->maskField(data, packet->data); 47 else 48 grid->inputField(data, packet->data); 49 } 54 50 // Convert missing values to NaN 55 51 if (hasMissingValue) -
XIOS/dev/branch_openmp/src/filter/source_filter.hpp
r1460 r1642 21 21 * \param gc the garbage collector associated with this filter 22 22 * \param grid the grid to which the data is attached 23 * \param compression 24 * \param mask 23 25 * \param offset the offset applied to the timestamp of all packets 24 26 * \param manualTrigger whether the output should be triggered manually … … 27 29 */ 28 30 CSourceFilter(CGarbageCollector& gc, CGrid* grid, 29 bool compression=true, 31 bool compression = true, 32 bool mask = false, 30 33 const CDuration offset = NoneDu, bool manualTrigger = false, 31 34 bool hasMissingValue = false, … … 61 64 62 65 private: 63 CGrid* grid; //!< The grid attached to the data the filter can accept64 const CDuration offset; //!< The offset applied to the timestamp of all packets66 CGrid* grid; //!< The grid attached to the data the filter can accept 67 const CDuration offset; //!< The offset applied to the timestamp of all packets 65 68 const bool hasMissingValue; 66 69 const double defaultValue; 67 const bool compression ; //!< indicate if the data need to be compressed : on client size : true, on server side : false 70 const bool compression ; //!< indicates if data need to be compressed : on client side : true, on server side : false 71 const bool mask ; //!< indicates whether grid mask should be applied (true for clients, false for servers) 68 72 }; // class CSourceFilter 69 73 } // namespace xios -
XIOS/dev/branch_openmp/src/filter/spatial_transform_filter.cpp
r1545 r1642 1 #include "mpi.hpp"2 1 #include "spatial_transform_filter.hpp" 3 2 #include "grid_transformation.hpp" … … 5 4 #include "context_client.hpp" 6 5 #include "timer.hpp" 7 using namespace ep_lib;8 6 9 7 namespace xios … … 70 68 onOutputReady(outputPacket); 71 69 } 72 73 74 75 76 70 77 71 CSpatialTemporalFilter::CSpatialTemporalFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, CGridTransformation* gridTransformation, double outputValue, size_t inputSlotsCount) … … 142 136 } 143 137 144 std::map<CGridTransformation*, std::shared_ptr<CSpatialTransformFilterEngine> > *CSpatialTransformFilterEngine::engines_ptr = 0;138 std::map<CGridTransformation*, std::shared_ptr<CSpatialTransformFilterEngine> > CSpatialTransformFilterEngine::engines; 145 139 146 140 CSpatialTransformFilterEngine* CSpatialTransformFilterEngine::get(CGridTransformation* gridTransformation) … … 149 143 ERROR("CSpatialTransformFilterEngine& CSpatialTransformFilterEngine::get(CGridTransformation* gridTransformation)", 150 144 "Impossible to get the requested engine, the grid transformation is invalid."); 151 152 if(engines_ptr == NULL) engines_ptr = new std::map<CGridTransformation*, std::shared_ptr<CSpatialTransformFilterEngine> >; 153 154 155 std::map<CGridTransformation*, std::shared_ptr<CSpatialTransformFilterEngine> >::iterator it = engines_ptr->find(gridTransformation); 156 if (it == engines_ptr->end()) 145 146 std::map<CGridTransformation*, std::shared_ptr<CSpatialTransformFilterEngine> >::iterator it = engines.find(gridTransformation); 147 if (it == engines.end()) 157 148 { 158 149 std::shared_ptr<CSpatialTransformFilterEngine> engine(new CSpatialTransformFilterEngine(gridTransformation)); 159 it = engines _ptr->insert(std::make_pair(gridTransformation, engine)).first;150 it = engines.insert(std::make_pair(gridTransformation, engine)).first; 160 151 } 161 152 … … 206 197 const std::list<CGridTransformation::RecvIndexGridDestinationMap>& listLocalIndexToReceive = gridTransformation->getLocalIndexToReceiveOnGridDest(); 207 198 const std::list<size_t>& listNbLocalIndexToReceive = gridTransformation->getNbLocalIndexToReceiveOnGridDest(); 208 const std::list<std::vector<bool> >& listLocalIndexMaskOnDest = gridTransformation->getLocalMaskIndexOnGridDest();209 199 const std::vector<CGenericAlgorithmTransformation*>& listAlgos = gridTransformation->getAlgos(); 210 200 … … 215 205 std::list<CGridTransformation::RecvIndexGridDestinationMap>::const_iterator itListRecv = listLocalIndexToReceive.begin(); 216 206 std::list<size_t>::const_iterator itNbListRecv = listNbLocalIndexToReceive.begin(); 217 std::list<std::vector<bool> >::const_iterator itLocalMaskIndexOnDest = listLocalIndexMaskOnDest.begin();218 207 std::vector<CGenericAlgorithmTransformation*>::const_iterator itAlgo = listAlgos.begin(); 219 208 220 for (; itListSend != iteListSend; ++itListSend, ++itListRecv, ++itNbListRecv, ++it LocalMaskIndexOnDest, ++itAlgo)209 for (; itListSend != iteListSend; ++itListSend, ++itListRecv, ++itNbListRecv, ++itAlgo) 221 210 { 222 211 CArray<double,1> dataCurrentSrc(dataCurrentDest); … … 235 224 236 225 idxSendBuff = 0; 237 std::vector<MPI_Request> sendRecvRequest(localIndexToSend.size() + itListRecv->size()); 238 int position = 0; 226 std::vector<ep_lib::MPI_Request> sendRecvRequest; 239 227 for (itSend = itbSend; itSend != iteSend; ++itSend, ++idxSendBuff) 240 228 { … … 246 234 sendBuff[idxSendBuff][idx] = dataCurrentSrc(localIndex_p(idx)); 247 235 } 248 MPI_Isend(sendBuff[idxSendBuff], countSize, MPI_DOUBLE, destRank, 12, client->intraComm, &sendRecvRequest[position++]); 236 sendRecvRequest.push_back(ep_lib::MPI_Request()); 237 ep_lib::MPI_Isend(sendBuff[idxSendBuff], countSize, EP_DOUBLE, destRank, 12, client->intraComm, &sendRecvRequest.back()); 249 238 } 250 239 … … 263 252 int srcRank = itRecv->first; 264 253 int countSize = itRecv->second.size(); 265 MPI_Irecv(recvBuff + currentBuff, countSize, MPI_DOUBLE, srcRank, 12, client->intraComm, &sendRecvRequest[position++]); 254 sendRecvRequest.push_back(ep_lib::MPI_Request()); 255 ep_lib::MPI_Irecv(recvBuff + currentBuff, countSize, EP_DOUBLE, srcRank, 12, client->intraComm, &sendRecvRequest.back()); 266 256 currentBuff += countSize; 267 257 } 268 std::vector< MPI_Status> status(sendRecvRequest.size());269 MPI_Waitall(sendRecvRequest.size(), &sendRecvRequest[0], &status[0]);258 std::vector<ep_lib::MPI_Status> status(sendRecvRequest.size()); 259 ep_lib::MPI_Waitall(sendRecvRequest.size(), &sendRecvRequest[0], &status[0]); 270 260 271 261 dataCurrentDest.resize(*itNbListRecv); 272 const std::vector<bool>& localMaskDest = *itLocalMaskIndexOnDest; 273 for (int i = 0; i < localMaskDest.size(); ++i) 274 if (localMaskDest[i]) dataCurrentDest(i) = 0.0; 275 else dataCurrentDest(i) = defaultValue; 262 dataCurrentDest = 0.0; 276 263 277 264 std::vector<bool> localInitFlag(dataCurrentDest.numElements(), true); -
XIOS/dev/branch_openmp/src/filter/spatial_transform_filter.hpp
r1545 r1642 141 141 142 142 //! The allocated engines 143 144 static std::map<CGridTransformation*, std::shared_ptr<CSpatialTransformFilterEngine> > *engines_ptr; 145 #pragma omp threadprivate(engines_ptr) 143 static std::map<CGridTransformation*, std::shared_ptr<CSpatialTransformFilterEngine> > engines; 146 144 }; // class CSpatialTransformFilterEngine 147 145 } // namespace xios -
XIOS/dev/branch_openmp/src/filter/temporal_filter.cpp
r1545 r1642 22 22 this->samplingOffset.second, this->samplingOffset.timestep) 23 23 , initDate(initDate) 24 // , nextSamplingDate(initDate + (this->samplingOffset + initDate.getRelCalendar().getTimeStep())) 24 25 , nextSamplingDate(initDate + offsetMonth + ( offsetAllButMonth + initDate.getRelCalendar().getTimeStep())) 25 26 , nbOperationDates(1)
Note: See TracChangeset
for help on using the changeset viewer.