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 720 of file fmu_function.cpp.

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