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

#include <fmu_function.hpp>

Detailed Description

Definition at line 96 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=0, std::vector< std::string > *name_out=0)
 

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 = 0,
std::vector< std::string > *  name_out = 0 
)
static

Definition at line 606 of file fmu_function.cpp.

607  {
608  // Return value
609  InputStruct s;
610  // Look for a prefix
611  if (has_prefix(n)) {
612  // Get the prefix
613  std::string pref, rem;
614  pref = pop_prefix(n, &rem);
615  if (pref == "out") {
616  if (has_prefix(rem)) {
617  // Second order function output (unused): Get the prefix
618  pref = pop_prefix(rem, &rem);
619  if (pref == "adj") {
620  s.type = InputType::ADJ_OUT;
621  s.ind = fmu ? fmu->index_in(rem) : -1;
622  if (name_in) name_in->push_back(rem);
623  } else {
624  casadi_error("Cannot process: " + n);
625  }
626  } else {
627  // Nondifferentiated function output (unused)
628  s.type = InputType::OUT;
629  s.ind = fmu ? fmu->index_out(rem) : -1;
630  if (name_out) name_out->push_back(rem);
631  }
632  } else if (pref == "fwd") {
633  // Forward seed
634  s.type = InputType::FWD;
635  s.ind = fmu ? fmu->index_in(rem) : 0;
636  if (name_in) name_in->push_back(rem);
637  } else if (pref == "adj") {
638  // Adjoint seed
639  s.type = InputType::ADJ;
640  s.ind = fmu ? fmu->index_out(rem) : 0;
641  if (name_out) name_out->push_back(rem);
642  } else {
643  // No such prefix
644  casadi_error("No such prefix: " + pref);
645  }
646  } else {
647  // No prefix - regular input
648  s.type = InputType::REG;
649  s.ind = fmu ? fmu->index_in(n) : 0;
650  if (name_in) name_in->push_back(n);
651  }
652  // Return input struct
653  return s;
654 }
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 100 of file fmu_function.hpp.

Referenced by parse().

◆ type

InputType casadi::InputStruct::type

Definition at line 98 of file fmu_function.hpp.

Referenced by parse().


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