@@ -119,7 +119,7 @@ SolidCRKSPHRZ(DataBase<Dimension>& dataBase,
119119 epsTensile,
120120 nTensile,
121121 damageRelieveRubble),
122- mPairAccelerationsPtr (),
122+ mPairAccelerationsPtr (std::make_unique<PairAccelerationsType>() ),
123123 mSelfAccelerations (FieldStorageType::CopyFields) {
124124}
125125
@@ -215,9 +215,9 @@ registerDerivatives(DataBase<Dimension>& dataBase,
215215 const auto & connectivityMap = dataBase.connectivityMap ();
216216 mPairAccelerationsPtr = std::make_unique<PairAccelerationsType>(connectivityMap);
217217 dataBase.resizeFluidFieldList (mSelfAccelerations , Vector::zero (), HydroFieldNames::selfAccelerations, false );
218- derivs.enroll (HydroFieldNames::pairAccelerations, *mPairAccelerationsPtr );
219218 derivs.enroll (HydroFieldNames::selfAccelerations, mSelfAccelerations );
220219 }
220+ derivs.enroll (HydroFieldNames::pairAccelerations, *mPairAccelerationsPtr );
221221}
222222
223223// ------------------------------------------------------------------------------
@@ -368,7 +368,7 @@ evaluateDerivativesImpl(const Dimension::Scalar /*time*/,
368368 auto localDvDx = derivs.fields (HydroFieldNames::internalVelocityGradient, Tensor::zero ());
369369 auto maxViscousPressure = derivs.fields (HydroFieldNames::maxViscousPressure, 0.0 );
370370 auto effViscousPressure = derivs.fields (HydroFieldNames::effectiveViscousPressure, 0.0 );
371- auto * pairAccelerationsPtr = derivs.template getPtr <PairAccelerationsType>(HydroFieldNames::pairAccelerations);
371+ auto & pairAccelerations = derivs.template get <PairAccelerationsType>(HydroFieldNames::pairAccelerations);
372372 auto selfAccelerations = derivs.fields (HydroFieldNames::selfAccelerations, Vector::zero (), true );
373373 auto XSPHDeltaV = derivs.fields (HydroFieldNames::XSPHDeltaV, Vector::zero ());
374374 auto DSDt = derivs.fields (IncrementState<Dimension, SymTensor>::prefix () + SolidFieldNames::deviatoricStress, SymTensor::zero ());
@@ -382,9 +382,9 @@ evaluateDerivativesImpl(const Dimension::Scalar /*time*/,
382382 CHECK (effViscousPressure.size () == numNodeLists);
383383 CHECK (XSPHDeltaV.size () == numNodeLists);
384384 CHECK (DSDt.size () == numNodeLists);
385- CHECK ((compatibleEnergy and pairAccelerationsPtr-> size () == npairs) or not compatibleEnergy);
386- CHECK ((compatibleEnergy and selfAccelerations.size () == 0u ) or
387- (not compatibleEnergy and selfAccelerations.size () == numNodeLists ));
385+ CHECK ((compatibleEnergy and pairAccelerations. size () == npairs) or not compatibleEnergy);
386+ CHECK ((compatibleEnergy and selfAccelerations.size () == numNodeLists ) or
387+ (selfAccelerations.size () == 0u ));
388388
389389 // Build the functor we use to compute the effective coupling between nodes.
390390 const NodeCoupling coupling;
@@ -539,8 +539,8 @@ evaluateDerivativesImpl(const Dimension::Scalar /*time*/,
539539 DvDtj += forceji/mRZj ;
540540 }
541541 if (compatibleEnergy) {
542- (*pairAccelerationsPtr) [kk][0 ] = -forceij/mRZi ;
543- (*pairAccelerationsPtr) [kk][1 ] = forceji/mRZj ;
542+ pairAccelerations [kk][0 ] = -forceij/mRZi ;
543+ pairAccelerations [kk][1 ] = forceji/mRZj ;
544544 }
545545
546546 // Energy
0 commit comments