Program Listing for File params.h

Return to documentation for file (states/params.h)

#pragma once
#include "lupnt/states/state.h"

namespace lupnt {

  class ParamState : public State {
  public:
    ParamState() : State() {
      SetType(TYPE);
      SetFrame(Frame::MOON_CI);
    }

    ParamState(int n) : State(n) {
      SetType(TYPE);
      SetFrame(Frame::MOON_CI);
    }

    ParamState(const VecX& x, std::vector<std::string> names) : State(x) {
      SetType(TYPE);
      SetNames(names);
      SetUnits(GetParamUnits(names));
      SetFrame(Frame::MOON_CI);
    }

    ParamState(const VecX& x, std::vector<std::string> names, std::vector<std::string> units)
        : State(x) {
      SetType(TYPE);
      SetNames(names);
      SetUnits(units);
      SetFrame(Frame::MOON_CI);
    }

    static constexpr StateType TYPE = "Params";

  private:
    std::vector<std::string> GetParamUnits(const std::vector<std::string>& names) {
      if (names.empty()) {
        return {"-"};
      }
      std::vector<std::string> units;
      for (const auto& name : names) {
        if (name == "bcoeff_drag" || name == "bcoeff_srp") {
          units.push_back("m^2/kg");
        } else if (name == "IntegerAmbiguity") {
          units.push_back("-");
        } else {
          units.push_back("-");
        }
      }
      return units;
    }
  };

}  // namespace lupnt