|
|
|
#pragma once
|
|
|
|
#include "DataAdapters/datafile.cpp"
|
|
|
|
#include "DataAdapters/findfilebyid.cpp"
|
|
|
|
#include "ParameterList.h"
|
|
|
|
#include "mregex.h"
|
|
|
|
#include "simple2ddata.h"
|
|
|
|
|
|
|
|
using michlib::GPL;
|
|
|
|
using michlib::MDateTime;
|
|
|
|
using michlib::RegExp;
|
|
|
|
|
|
|
|
class BINFILEData
|
|
|
|
{
|
|
|
|
std::vector<MDateTime> times;
|
|
|
|
MString datapath;
|
|
|
|
std::unique_ptr<michlib::IntData> data;
|
|
|
|
|
|
|
|
public:
|
|
|
|
static constexpr const char* name = "BINFILE";
|
|
|
|
|
|
|
|
static constexpr const char* disabledactions = "genintfile";
|
|
|
|
|
|
|
|
using Data = Simple2DData;
|
|
|
|
|
|
|
|
BINFILEData() = default;
|
|
|
|
|
|
|
|
MString Info() const;
|
|
|
|
// TODO: RetVal
|
|
|
|
MString Open(const CLArgs& args);
|
|
|
|
|
|
|
|
bool isOk() const { return times.size() > 0; }
|
|
|
|
|
|
|
|
size_t NTimes() const { return times.size(); }
|
|
|
|
|
|
|
|
MDateTime Time(size_t i) const
|
|
|
|
{
|
|
|
|
if(!isOk() || i >= times.size()) return MDateTime();
|
|
|
|
return times[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
time_t Timestep() const { return isOk() ? (times[1] - times[0]) : 0; }
|
|
|
|
|
|
|
|
explicit operator bool() const { return times.size() > 0; }
|
|
|
|
|
|
|
|
bool CheckVar(const MString& vname) const { return vname == "u" || vname == "v" || vname == "U" || vname == "U2"; }
|
|
|
|
|
|
|
|
bool Read(const MString& vname, std::map<MString, Data>& cache, size_t i) const;
|
|
|
|
};
|