You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

44 lines
1.0 KiB

#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:
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"; }
Data Read(const MString& vname, size_t i) const;
};