Skip to content

Commit

Permalink
Removed initialization and finalization of derivative calculations in…
Browse files Browse the repository at this point in the history
… KSTrajInterpolatorHermite.cxx pending more testing.
  • Loading branch information
pslocum committed Dec 27, 2016
1 parent 7e0a0ca commit 9e0c131
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
8 changes: 8 additions & 0 deletions Kassiopeia/Trajectories/Include/KSTrajInterpolatorHermite.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ namespace Kassiopeia
virtual ~KSTrajInterpolatorHermite();

public:
void GetInterpolate(double aTime,
const KSTrajAdiabaticIntegrator& anIntegrator,
const KSTrajAdiabaticDifferentiator& aDifferentiator,
const KSTrajAdiabaticParticle& anInitialParticle,
const KSTrajAdiabaticParticle& aFinalParticle,
const double& aTimeStep,
KSTrajAdiabaticParticle& anIntermediateParticle ) const;


virtual void Interpolate(double aTime, const KSTrajExactIntegrator& anIntegrator, const KSTrajExactDifferentiator& aDifferentiator, const KSTrajExactParticle& anInitialParticle, const KSTrajExactParticle& aFinalParticle, const double& aTimeStep, KSTrajExactParticle& anIntermediateParticle ) const;

Expand Down
28 changes: 26 additions & 2 deletions Kassiopeia/Trajectories/Source/KSTrajInterpolatorHermite.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,23 @@ namespace Kassiopeia
}
}

void KSTrajInterpolatorHermite::GetInterpolate(double aTime,
const KSTrajAdiabaticIntegrator& anIntegrator,
const KSTrajAdiabaticDifferentiator& aDifferentiator,
const KSTrajAdiabaticParticle& anInitialParticle,
const KSTrajAdiabaticParticle& aFinalParticle,
const double& aTimeStep,
KSTrajAdiabaticParticle& anIntermediateParticle ) const
{
// This is a routine to call the interpolater from a step modifier for Project 8.


KSTrajInterpolatorHermite::Interpolate(aTime, anIntegrator, aDifferentiator, anInitialParticle, aFinalParticle, aTimeStep, anIntermediateParticle);

}



void KSTrajInterpolatorHermite::Interpolate(double aTime,
const KSTrajAdiabaticIntegrator& anIntegrator,
const KSTrajAdiabaticDifferentiator& aDifferentiator,
Expand Down Expand Up @@ -132,9 +149,14 @@ namespace Kassiopeia
CubicHermite(tFraction, h30, h31, h32, h33);

//retrieve the first derivative evaluation from the integrator

KSTrajAdiabaticDerivative initialDerivative;
initialDerivative = 0.0;
bool isValid = anIntegrator.GetInitialDerivative(initialDerivative);
// bool isValid = anIntegrator.GetInitialDerivative(initialDerivative);

bool isValid = true; // Project 8 edit


if(!isValid)
{
aDifferentiator.Differentiate(anInitialParticle.GetTime(), anInitialParticle, initialDerivative);
Expand All @@ -143,7 +165,8 @@ namespace Kassiopeia
//retrieve the final derivative evaluation from the integrator
KSTrajAdiabaticDerivative finalDerivative;
finalDerivative = 0.0;
isValid = anIntegrator.GetFinalDerivative(finalDerivative);
// isValid = anIntegrator.GetFinalDerivative(finalDerivative);
isValid = true; // Project 8 edit
if(!isValid)
{
aDifferentiator.Differentiate(aFinalParticle.GetTime(), aFinalParticle, finalDerivative);
Expand All @@ -154,6 +177,7 @@ namespace Kassiopeia
anIntermediateParticle[0] = tInterpolatedTime; //explicitly set the time variable
}


//interpolate alpha and beta linearly
//(leaving this unchanged from fast interpolator, may need to improve this)
KThreeVector tInitialAlpha = anInitialParticle.GetAlpha().Unit();
Expand Down
3 changes: 3 additions & 0 deletions Kassiopeia/Trajectories/Source/KSTrajTrajectoryAdiabatic.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ namespace Kassiopeia
{
}



void KSTrajTrajectoryAdiabatic::SetIntegrator( KSTrajAdiabaticIntegrator* anIntegrator )
{
if( fIntegrator == NULL )
Expand All @@ -62,6 +64,7 @@ namespace Kassiopeia
trajmsg( eError ) << "cannot set integrator in <" << this->GetName() << "> with <" << anIntegrator << ">" << eom;
return;
}

void KSTrajTrajectoryAdiabatic::ClearIntegrator( KSTrajAdiabaticIntegrator* anIntegrator )
{
if( fIntegrator == anIntegrator )
Expand Down

0 comments on commit 9e0c131

Please sign in to comment.