NS_IMETHODIMP WheelEvent::GetDeltaZ(double* aDeltaZ) { NS_ENSURE_ARG_POINTER(aDeltaZ); *aDeltaZ = DeltaZ(); return NS_OK; }
void radTg3d::ActualEnergyForceTorqueComp(radTField* FieldPtr) { TVector3d ZeroVect(0.,0.,0.); const double DeltaL = 1.E-01; // mm //const double DeltaL = 1.; // mm const double DeltaTeta = 1.E-03; // rad radTField LocField(FieldPtr->FieldKey, FieldPtr->CompCriterium, FieldPtr->HandleEnergyForceTorqueCompData); double& Enr = LocField.Energy; double Ex1, Ex2, Ey1, Ey2, Ez1, Ez2; if(FieldPtr->FieldKey.Energy_) { Enr = 0.; (g3dListOfTransform.empty())? SimpleEnergyComp(&LocField) : NestedFor_Energy(&LocField, g3dListOfTransform.begin()); FieldPtr->Energy += LocField.Energy; } if(FieldPtr->FieldKey.ForceEnr_) { LocField.CompCriterium.BasedOnWorstRelPrec = 1; TVector3d DeltaX(-DeltaL/2., 0., 0.), DeltaY(0., -DeltaL/2., 0.), DeltaZ(0., 0., -DeltaL/2.); radTrans *SmallTranslXPtr = new radTrans(), *SmallTranslYPtr = new radTrans(), *SmallTranslZPtr = new radTrans(); radThg hTranslX(SmallTranslXPtr), hTranslY(SmallTranslYPtr), hTranslZ(SmallTranslZPtr); SmallTranslXPtr->SetupTranslation(DeltaX); SmallTranslYPtr->SetupTranslation(DeltaY); SmallTranslZPtr->SetupTranslation(DeltaZ); AddTransform(1, hTranslX); //AddTransform_OtherSide(1, hTranslX); Enr = 0.; NestedFor_Energy(&LocField, g3dListOfTransform.begin()); Ex1 = Enr; SmallTranslXPtr->Invert(); Enr = 0.; NestedFor_Energy(&LocField, g3dListOfTransform.begin()); Ex2 = Enr; EraseOuterTransform(); //EraseInnerTransform(); AddTransform(1, hTranslY); //AddTransform_OtherSide(1, hTranslY); Enr = 0.; NestedFor_Energy(&LocField, g3dListOfTransform.begin()); Ey1 = Enr; SmallTranslYPtr->Invert(); Enr = 0.; NestedFor_Energy(&LocField, g3dListOfTransform.begin()); Ey2 = Enr; EraseOuterTransform(); //EraseInnerTransform(); AddTransform(1, hTranslZ); //AddTransform_OtherSide(1, hTranslZ); Enr = 0.; NestedFor_Energy(&LocField, g3dListOfTransform.begin()); Ez1 = Enr; SmallTranslZPtr->Invert(); Enr = 0.; NestedFor_Energy(&LocField, g3dListOfTransform.begin()); Ez2 = Enr; EraseOuterTransform(); //EraseInnerTransform(); double Const = 1000./DeltaL; TVector3d LocForce(Const*(Ex1 - Ex2), Const*(Ey1 - Ey2), Const*(Ez1 - Ez2)); if(FieldPtr->FieldKey.ForceEnr_) FieldPtr->Force += LocForce; } if(FieldPtr->FieldKey.Torque_) { LocField.CompCriterium.BasedOnWorstRelPrec = 1; radTrans *SmallRotXaxPtr = new radTrans(), *SmallRotYaxPtr = new radTrans(), *SmallRotZaxPtr = new radTrans(); radThg hRotX(SmallRotXaxPtr), hRotY(SmallRotYaxPtr), hRotZ(SmallRotZaxPtr); TVector3d OrtX(1.,0.,0.), OrtY(0.,1.,0.), OrtZ(0.,0.,1.); SmallRotXaxPtr->SetupRotation(FieldPtr->P, OrtX, -DeltaTeta/2.); SmallRotYaxPtr->SetupRotation(FieldPtr->P, OrtY, -DeltaTeta/2.); SmallRotZaxPtr->SetupRotation(FieldPtr->P, OrtZ, -DeltaTeta/2.); AddTransform(1, hRotX); //AddTransform_OtherSide(1, hRotX); Enr = 0.; NestedFor_Energy(&LocField, g3dListOfTransform.begin()); Ex1 = Enr; SmallRotXaxPtr->Invert(); Enr = 0.; NestedFor_Energy(&LocField, g3dListOfTransform.begin()); Ex2 = Enr; EraseOuterTransform(); //EraseInnerTransform(); AddTransform(1, hRotY); //AddTransform_OtherSide(1, hRotY); Enr = 0.; NestedFor_Energy(&LocField, g3dListOfTransform.begin()); Ey1 = Enr; SmallRotYaxPtr->Invert(); Enr = 0.; NestedFor_Energy(&LocField, g3dListOfTransform.begin()); Ey2 = Enr; EraseOuterTransform(); //EraseInnerTransform(); AddTransform(1, hRotZ); //AddTransform_OtherSide(1, hRotZ); Enr = 0.; NestedFor_Energy(&LocField, g3dListOfTransform.begin()); Ez1 = Enr; SmallRotZaxPtr->Invert(); Enr = 0.; NestedFor_Energy(&LocField, g3dListOfTransform.begin()); Ez2 = Enr; EraseOuterTransform(); //EraseInnerTransform(); double Const = 1000./DeltaTeta; TVector3d LocTorque(Const*(Ex1 - Ex2), Const*(Ey1 - Ey2), Const*(Ez1 - Ez2)); if(FieldPtr->FieldKey.Torque_) FieldPtr->Torque += LocTorque; } }