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

#include <fmu_function.hpp>

Detailed Description

Definition at line 94 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 717 of file fmu_function.cpp.

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

Referenced by parse().

◆ type

InputType casadi::InputStruct::type

Definition at line 96 of file fmu_function.hpp.

Referenced by parse().


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