IODA Bundle
BufrIntCollector.cpp
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2020 NOAA/NWS/NCEP/EMC
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  */
7 
8 #if __has_include("bufr_interface.h") // TODO(rmclaren): Remove this in future
9  #include "bufr_interface.h"
10 #else
11  #include "bufr.interface.h"
12 #endif
13 
14 #include "BufrIntCollector.h"
15 
16 
17 namespace Ingester
18 {
19  BufrIntCollector::BufrIntCollector(const int fortranFileId, const BufrMnemonicSet& mnemonicSet):
20  BufrCollector(fortranFileId, mnemonicSet)
21  {
24  }
25 
27  {
28  double* scratchDataPtr = scratchData_.data();
29 
30  int result;
31  ufbint_f(fortranFileId_,
32  reinterpret_cast<void**> (&scratchDataPtr),
35  &result,
36  mnemonicSet_.getMnemonicsStr().c_str());
37 
38  for (Eigen::Index colIdx = 0; colIdx < accumulator_.getNumColumns(); colIdx++)
39  {
40  floatTypeScratchData_[colIdx] = static_cast<FloatType>(scratchData_[colIdx]);
41  }
42 
44  }
45 } // namespace Ingester
void addRow(std::vector< FloatType > &newRow)
Add row of data to the internal data structure.
Eigen::Index getNumColumns() const
Collectors know how to use the BUFR interface to grab data associated with configured mnemonicSets.
Definition: BufrCollector.h:25
BufrAccumulator accumulator_
Accumulator to collect the data we are collecting.
Definition: BufrCollector.h:42
const BufrMnemonicSet mnemonicSet_
Specifies the mnemonics and channels this collector gets from the BUFR file.
Definition: BufrCollector.h:45
const int fortranFileId_
Fortran file ID for the open BUFR file.
Definition: BufrCollector.h:39
BufrIntCollector(const int fortranFileId, const BufrMnemonicSet &mnemonicSet)
std::vector< FloatType > floatTypeScratchData_
std::vector< double > scratchData_
Pre-allocated buffer to hand to the Fortran interface.
void collect() final
Grab the next section of data.
Defenition of BUFR mnemonics and associated channels of interest.
std::string getMnemonicsStr() const
float FloatType
Definition: IngesterTypes.h:18