|
|
|
#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; }
|
|
|
|
|
|
|
|
VarPresence CheckVar(const MString& vname) const
|
|
|
|
{
|
|
|
|
if(vname == "u" || vname == "v") return VarPresence::INTERNAL;
|
|
|
|
if(vname == "U" || vname == "U2") return VarPresence::DERIVED;
|
|
|
|
return VarPresence::NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Read(const MString& vname, std::map<MString, Data>& cache, size_t i) const;
|
|
|
|
};
|