mirror of
https://github.com/nasa/trick.git
synced 2024-12-22 06:27:49 +00:00
314e962edf
Removed the requirement of passing flags throughout ICG indicating if we are in an inherited class or not. Removed the init_attr friends throughout Trick core headers.
126 lines
3.2 KiB
C++
126 lines
3.2 KiB
C++
/*******************************************************************************
|
|
|
|
Purpose:
|
|
(Define class Euler_Cromer_Integrator.)
|
|
|
|
Programmers:
|
|
(((David Hammen) (Odyssey) (July 2012) (JEOD_2.2 #462)
|
|
(Joint /JEOD integration framework)))
|
|
|
|
*******************************************************************************/
|
|
|
|
#ifndef EULER_CROMER_INTEGRATOR_HH
|
|
#define EULER_CROMER_INTEGRATOR_HH
|
|
|
|
#ifdef USE_ER7_UTILS_INTEGRATORS
|
|
#include <cstring>
|
|
|
|
#include "er7_utils/integration/symplectic_euler/include/symplectic_euler_integrator_constructor.hh"
|
|
#include "er7_utils/trick/integration/include/second_order_ode_integrator.hh"
|
|
|
|
|
|
namespace Trick {
|
|
|
|
/**
|
|
* Helper class for Euler_Cromer_Integrator
|
|
*/
|
|
class Euler_Cromer_IntegratorHelper {
|
|
protected:
|
|
|
|
er7_utils::SymplecticEulerIntegratorConstructor
|
|
helper_integ_constructor; /* --
|
|
The integrator constructor associated with Euler Cromer integration. */
|
|
};
|
|
|
|
|
|
/**
|
|
* Integrator using the Euler Cromer method.
|
|
*/
|
|
class Euler_Cromer_Integrator :
|
|
protected Euler_Cromer_IntegratorHelper,
|
|
public er7_utils::TrickSecondOrderOdeIntegrator {
|
|
|
|
public:
|
|
|
|
/** Default constructor, needed by the MemoryManager. */
|
|
Euler_Cromer_Integrator () {}
|
|
|
|
/** Copy constructor, needed for backwards compatibility. */
|
|
Euler_Cromer_Integrator (const Euler_Cromer_Integrator & src)
|
|
:
|
|
Euler_Cromer_IntegratorHelper (src),
|
|
TrickSecondOrderOdeIntegrator (src, helper_integ_constructor)
|
|
{}
|
|
|
|
/** Non default constructor, needed by getIntegrator. */
|
|
Euler_Cromer_Integrator (int state_size, double delta_t)
|
|
:
|
|
Euler_Cromer_IntegratorHelper (),
|
|
TrickSecondOrderOdeIntegrator (
|
|
helper_integ_constructor, state_size, delta_t, true)
|
|
{}
|
|
|
|
/** Assignment operator. */
|
|
Euler_Cromer_Integrator & operator= (Euler_Cromer_Integrator src)
|
|
{
|
|
helper_integ_constructor = src.helper_integ_constructor;
|
|
TrickSecondOrderOdeIntegrator::swap (src);
|
|
return *this;
|
|
}
|
|
|
|
|
|
/**
|
|
* Take the next integration step.
|
|
* @return non-zero step number or zero upon completion.
|
|
*/
|
|
virtual int integrate ()
|
|
{
|
|
std::memcpy (state + half_state_size,
|
|
er7_deriv, half_state_size*sizeof(double));
|
|
return TrickSecondOrderOdeIntegrator::integrate();
|
|
}
|
|
|
|
/** Destructor. */
|
|
virtual ~Euler_Cromer_Integrator() {}
|
|
|
|
virtual Integrator_type get_Integrator_type() { return Euler_Cromer; }
|
|
|
|
};
|
|
|
|
}
|
|
#else
|
|
|
|
#include "trick/Integrator.hh"
|
|
/**
|
|
PURPOSE: (Integrator using Euler Cromer method.)
|
|
*/
|
|
namespace Trick {
|
|
|
|
/** Integrator using Euler Cromer method.
|
|
*/
|
|
class Euler_Cromer_Integrator : public Integrator {
|
|
|
|
public:
|
|
/** Default Constructor. This must remain public so the MM can create these. */
|
|
Euler_Cromer_Integrator() {};
|
|
Euler_Cromer_Integrator( int State_size, double Dt);
|
|
virtual ~Euler_Cromer_Integrator();
|
|
|
|
void deriv2_in(double* arg1, ...)
|
|
#ifndef SWIGPYTHON
|
|
#ifdef __GNUC__
|
|
#if __GNUC__ >= 4
|
|
__attribute__((sentinel))
|
|
#endif
|
|
#endif
|
|
#endif
|
|
;
|
|
void initialize( int State_size, double Dt);
|
|
int integrate();
|
|
Integrator_type get_Integrator_type() { return(Euler_Cromer); } ;
|
|
};
|
|
}
|
|
#endif
|
|
|
|
#endif
|