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

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