List of all members | Static Public Member Functions | Public Attributes
casadi::InputStruct Struct Reference

#include <fmu_function.hpp>

Detailed Description

Definition at line 97 of file fmu_function.hpp.

Static Public Member Functions

static InputStruct parse (const std::string &n, const Fmu *fmu, std::vector< std::string > *name_in=nullptr, std::vector< std::string > *name_out=nullptr)
 

Public Attributes

InputType type
 
size_t ind
 

Member Function Documentation

◆ parse()

InputStruct casadi::InputStruct::parse ( const std::string &  n,
const Fmu *  fmu,
std::vector< std::string > *  name_in = nullptr,
std::vector< std::string > *  name_out = nullptr 
)
static

Definition at line 724 of file fmu_function.cpp.

725  {
726  // Return value
727  InputStruct s;
728  // Look for a prefix
729  if (has_prefix(n)) {
730  // Get the prefix
731  std::string pref, rem;
732  pref = pop_prefix(n, &rem);
733  if (pref == "out") {
734  if (has_prefix(rem)) {
735  // Second order function output (unused): Get the prefix
736  pref = pop_prefix(rem, &rem);
737  if (pref == "adj") {
738  s.type = InputType::ADJ_OUT;
739  s.ind = fmu ? fmu->index_in(rem) : -1;
740  if (name_in) name_in->push_back(rem);
741  } else {
742  casadi_error("Cannot process: " + n);
743  }
744  } else {
745  // Nondifferentiated function output (unused)
746  s.type = InputType::OUT;
747  s.ind = fmu ? fmu->index_out(rem) : -1;
748  if (name_out) name_out->push_back(rem);
749  }
750  } else if (pref == "fwd") {
751  // Forward seed
752  s.type = InputType::FWD;
753  s.ind = fmu ? fmu->index_in(rem) : 0;
754  if (name_in) name_in->push_back(rem);
755  } else if (pref == "adj") {
756  // Adjoint seed
757  s.type = InputType::ADJ;
758  s.ind = fmu ? fmu->index_out(rem) : 0;
759  if (name_out) name_out->push_back(rem);
760  } else {
761  // No such prefix
762  casadi_error("No such prefix: " + pref);
763  }
764  } else {
765  // No prefix - regular input
766  s.type = InputType::REG;
767  s.ind = fmu ? fmu->index_in(n) : 0;
768  if (name_in) name_in->push_back(n);
769  }
770  // Return input struct
771  return s;
772 }
bool has_prefix(const std::string &s)
std::string pop_prefix(const std::string &s, std::string *rem)

References casadi::ADJ, casadi::ADJ_OUT, casadi::FWD, casadi::has_prefix(), ind, casadi::FmuInternal::index_in(), casadi::FmuInternal::index_out(), casadi::OUT, casadi::pop_prefix(), casadi::REG, and type.

Referenced by casadi::FmuFunction::FmuFunction(), and casadi::FmuFunction::identify_io().

Member Data Documentation

◆ ind

size_t casadi::InputStruct::ind

Definition at line 101 of file fmu_function.hpp.

Referenced by parse().

◆ type

InputType casadi::InputStruct::type

Definition at line 99 of file fmu_function.hpp.

Referenced by parse().


The documentation for this struct was generated from the following files: