Skip to content

Commit

Permalink
Minor extensions for Python exposure
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicDirkx committed Dec 18, 2023
1 parent 7e61a61 commit 8838caf
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
13 changes: 12 additions & 1 deletion include/tudat/basics/utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ std::vector< T > getStlVectorSegment( const std::vector< T > originalVector, con
}

template< typename T, typename S >
std::vector< T > staticCastVector( const std::vector< S > originalVector )
std::vector< T > staticCastVector( const std::vector< S >& originalVector )
{
std::vector< T > castVector;
for( unsigned int i = 0; i < originalVector.size( ); i++ )
Expand All @@ -883,6 +883,17 @@ std::vector< T > staticCastVector( const std::vector< S > originalVector )
return castVector;
}

template< typename T, typename S, typename U >
std::map< T, U > staticCastMapKeys( const std::map< S, U >& originalMap )
{
std::map< T, U > castMap;
for( auto it : originalMap )
{
castMap[ static_cast< T >( it.first) ] = it.second;
}
return castMap;
}

template <typename T>
Eigen::Matrix< T, Eigen::Dynamic, 1 > getSuccesivelyConcatenatedVector(
const Eigen::Matrix< T, Eigen::Dynamic, 1 > baseVector, const unsigned int numberOfConcatenations )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,8 @@ class SingleArcDynamicsSimulator: public DynamicsSimulator< StateScalarType, Tim
return propagationResults_->equationsOfMotionNumericalSolution_;
}



//! Function to return the map of state history of numerically integrated bodies, in propagation coordinates.
/*!
* Function to return the map of state history of numerically integrated bodies, in propagation coordinates.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ namespace tudat
return equationsOfMotionNumericalSolution_;
}

std::map< double, Eigen::Matrix< StateScalarType, Eigen::Dynamic, 1 > > getEquationsOfMotionNumericalSolutionDouble( )
{
return utilities::staticCastMapKeys< double, Time, Eigen::Matrix< StateScalarType, Eigen::Dynamic, 1 > >( equationsOfMotionNumericalSolution_ );
}

std::map <TimeType, Eigen::Matrix<StateScalarType, Eigen::Dynamic, 1>> &
getEquationsOfMotionNumericalSolutionRaw( )
{
Expand Down

0 comments on commit 8838caf

Please sign in to comment.