diff --git a/Source/Generators/LMCArraySignalGenerator.cc b/Source/Generators/LMCArraySignalGenerator.cc index 669a1b9a..4412d46d 100644 --- a/Source/Generators/LMCArraySignalGenerator.cc +++ b/Source/Generators/LMCArraySignalGenerator.cc @@ -393,11 +393,10 @@ namespace locust if (fabs(EFieldBuffer[channel*fNElementsPerStrip+element].front()) > 0.) // field arrived yet? { - double* HilbertMagPhaseMean = new double[3]; + std::vector HilbertMagPhaseMean; HilbertMagPhaseMean.resize(3); HilbertMagPhaseMean = fHilbertTransform.GetMagPhaseMean(EFieldBuffer[channel*fNElementsPerStrip+element], EFrequencyBuffer[channel*fNElementsPerStrip+element]); HilbertMag = HilbertMagPhaseMean[0]; HilbertPhase = HilbertMagPhaseMean[1]; - delete[] HilbertMagPhaseMean; for (int i=0; i < nfilterbins; i++) // populate filter with field. { @@ -438,7 +437,7 @@ namespace locust Receiver* currentElement = allRxChannels[channelIndex][elementIndex]; sampleIndex = channelIndex*signalSize*aSignal->DecimationFactor() + index; // which channel and which sample - double* tFieldSolution = new double[2]; + std::vector tFieldSolution; //tFieldSolution.resize(2); if (!fTransmitter->IsKassiopeia()) { tFieldSolution = fTransmitter->GetEFieldCoPol(tTotalElementIndex, 1./(fAcquisitionRate*1.e6*aSignal->DecimationFactor())); diff --git a/Source/Transforms/LMCHilbertTransform.cc b/Source/Transforms/LMCHilbertTransform.cc index a3edf4c6..100444a9 100644 --- a/Source/Transforms/LMCHilbertTransform.cc +++ b/Source/Transforms/LMCHilbertTransform.cc @@ -66,12 +66,12 @@ namespace locust } - double* HilbertTransform::GetMagPhaseMean(std::deque FieldBuffer, std::deque FrequencyBuffer) + std::vector HilbertTransform::GetMagPhaseMean(std::deque FieldBuffer, std::deque FrequencyBuffer) { fftw_complex* transformeddata = Transform( FieldBuffer ); unsigned hilbertindex = fbufferMargin; - double* magphasemean = new double[3]; + std::vector magphasemean; magphasemean.resize(3); double mag = pow(transformeddata[hilbertindex][0]*transformeddata[hilbertindex][0] + transformeddata[hilbertindex][1]*transformeddata[hilbertindex][1], 0.5); double mean = 0.; // this is set to zero in HilbertTransform::Transform(). @@ -133,9 +133,9 @@ namespace locust } - double* HilbertTransform::GetSpan( fftw_complex* array, int IQ, int size ) + std::vector HilbertTransform::GetSpan( fftw_complex* array, int IQ, int size ) { - double* span = new double[2]; + std::vector span; span.resize(2); double max = -99.; double min = 99.; for (unsigned i=size/4; i<3*size/4; i++) @@ -230,8 +230,8 @@ namespace locust } - double* spanI = GetSpan(originaldata, 0, FieldBuffer.size()); - double* spanQ = GetSpan(originaldata, 1, FieldBuffer.size()); + std::vector spanI = GetSpan(originaldata, 0, FieldBuffer.size()); + std::vector spanQ = GetSpan(originaldata, 1, FieldBuffer.size()); for (int i = 0; i < windowsize; ++i) { diff --git a/Source/Transforms/LMCHilbertTransform.hh b/Source/Transforms/LMCHilbertTransform.hh index 48303a06..5156f3dd 100644 --- a/Source/Transforms/LMCHilbertTransform.hh +++ b/Source/Transforms/LMCHilbertTransform.hh @@ -33,7 +33,7 @@ namespace locust HilbertTransform(); virtual ~HilbertTransform(); bool Configure( const scarab::param_node& aNode); - double* GetMagPhaseMean(std::deque FieldBuffer, std::deque FrequencyBuffer); + std::vector GetMagPhaseMean(std::deque FieldBuffer, std::deque FrequencyBuffer); void SetBufferSize( int aBufferSize ); void SetBufferMargin( int aBufferMargin ); int GetBufferSize(); @@ -46,7 +46,7 @@ namespace locust double* GetFrequencyData(std::deque FrequencyBuffer); double GetMean( std::deque FieldBuffer ); double GetMean( fftw_complex* array, int IQ, int size ); - double* GetSpan( fftw_complex* array, int IQ, int size ); + std::vector GetSpan( fftw_complex* array, int IQ, int size ); double GetPhase( double VI, double VQ, double VMean); double QuadrantCorrection( double VI, double HilbertPhase, double HilbertMean ); int fbufferMargin; diff --git a/Source/Transmitters/LMCAntennaSignalTransmitter.cc b/Source/Transmitters/LMCAntennaSignalTransmitter.cc index 6af80967..f003eca6 100644 --- a/Source/Transmitters/LMCAntennaSignalTransmitter.cc +++ b/Source/Transmitters/LMCAntennaSignalTransmitter.cc @@ -85,7 +85,7 @@ namespace locust } - double* AntennaSignalTransmitter::GetEFieldCoPol(int fieldPointIndex, double dt) + std::vector AntennaSignalTransmitter::GetEFieldCoPol(int fieldPointIndex, double dt) { LMCThreeVector pointOfInterest=GetFieldPoint(fieldPointIndex); double estimatedField=0.0; @@ -126,7 +126,7 @@ namespace locust } // nAntennas - double* FieldSolution = new double[2]; + std::vector FieldSolution; FieldSolution.resize(2); FieldSolution[0] = estimatedField / fTransmitterHardware->GetPropagationDistance(pointOfInterest); // field at point FieldSolution[1] = 2. * LMCConst::Pi() * fInputFrequency; // rad/s diff --git a/Source/Transmitters/LMCAntennaSignalTransmitter.hh b/Source/Transmitters/LMCAntennaSignalTransmitter.hh index 3d65e9b2..80efd2b0 100644 --- a/Source/Transmitters/LMCAntennaSignalTransmitter.hh +++ b/Source/Transmitters/LMCAntennaSignalTransmitter.hh @@ -50,7 +50,7 @@ namespace locust bool Configure( const scarab::param_node& aNode ); /// Generate the electric field based on the voltage input from the config file and convolution with FIR - virtual double* GetEFieldCoPol(int fieldPointIndex, double dt); + virtual std::vector GetEFieldCoPol(int fieldPointIndex, double dt); /// Get initial phase delay double GetInitialPhaseDelay(); diff --git a/Source/Transmitters/LMCKassTransmitter.cc b/Source/Transmitters/LMCKassTransmitter.cc index 3571f7c0..cf125e46 100644 --- a/Source/Transmitters/LMCKassTransmitter.cc +++ b/Source/Transmitters/LMCKassTransmitter.cc @@ -45,7 +45,7 @@ namespace locust fFieldSolver.AddFieldPoint(fieldPoint); } - double* KassTransmitter::SolveKassFields(LMCThreeVector pointOfInterest, LMCThreeVector coPolDirection, double tReceiverTime, unsigned tTotalElementIndex) + std::vector KassTransmitter::SolveKassFields(LMCThreeVector pointOfInterest, LMCThreeVector coPolDirection, double tReceiverTime, unsigned tTotalElementIndex) { fFieldSolver.SetFieldEvent(tReceiverTime, tTotalElementIndex); @@ -63,7 +63,8 @@ namespace locust double tEFieldCoPol = tRadiatedElectricField.Dot(coPolDirection); SetIncidentKVector(tTotalElementIndex,tRadiatedElectricField.Cross(tRadiatedMagneticField)); - double* tSolution = new double[2]; + std::vector tSolution; + tSolution.resize(2); tSolution[0] = tEFieldCoPol; tSolution[1] = tDopplerFrequency; diff --git a/Source/Transmitters/LMCKassTransmitter.hh b/Source/Transmitters/LMCKassTransmitter.hh index 23522eb2..447145bc 100644 --- a/Source/Transmitters/LMCKassTransmitter.hh +++ b/Source/Transmitters/LMCKassTransmitter.hh @@ -15,7 +15,6 @@ #include "LMCLienardWiechert.hh" #include "LMCGlobalsDeclaration.hh" - namespace locust { @@ -44,8 +43,8 @@ namespace locust virtual bool IsKassiopeia(); - double* SolveKassFields(LMCThreeVector pointOfInterest, LMCThreeVector coPolDirection, double tReceiverTime, unsigned tTotalElementIndex); - void InitializeFieldPoint(LMCThreeVector fieldPoint); + std::vector SolveKassFields(LMCThreeVector pointOfInterest, LMCThreeVector coPolDirection, double tReceiverTime, unsigned tTotalElementIndex); + void InitializeFieldPoint(LMCThreeVector fieldPoint); private: diff --git a/Source/Transmitters/LMCPlaneWaveTransmitter.cc b/Source/Transmitters/LMCPlaneWaveTransmitter.cc index f152c4a5..bac221ec 100644 --- a/Source/Transmitters/LMCPlaneWaveTransmitter.cc +++ b/Source/Transmitters/LMCPlaneWaveTransmitter.cc @@ -74,7 +74,7 @@ namespace locust //fIncidentKVector.SetComponents(cos(fAOI), 0.0, sin(fAOI)); } - double* PlaneWaveTransmitter::GetEFieldCoPol(int fieldPointIndex, double dt) + std::vector PlaneWaveTransmitter::GetEFieldCoPol(int fieldPointIndex, double dt) { double initialPhaseDelay = GetPropagationPhaseDelay(fieldPointIndex); double fieldAmp = fAmplitude; @@ -84,7 +84,7 @@ namespace locust double fieldValue = fieldAmp*cos(fPhaseDelay + initialPhaseDelay); //AddIncidentKVector(pointOfInterest); - double* fieldSolution = new double[2]; + std::vector fieldSolution; fieldSolution.resize(2); fieldSolution[0] = fieldValue; fieldSolution[1] = 2. * LMCConst::Pi() * fRF_Frequency; // rad/s diff --git a/Source/Transmitters/LMCPlaneWaveTransmitter.hh b/Source/Transmitters/LMCPlaneWaveTransmitter.hh index d5f5066e..58889cb5 100644 --- a/Source/Transmitters/LMCPlaneWaveTransmitter.hh +++ b/Source/Transmitters/LMCPlaneWaveTransmitter.hh @@ -39,7 +39,7 @@ namespace locust bool Configure( const scarab::param_node& aNode ); - virtual double* GetEFieldCoPol(int fieldIndexPoint, double dt); + virtual std::vector GetEFieldCoPol(int fieldIndexPoint, double dt); private: diff --git a/Source/Transmitters/LMCTransmitter.hh b/Source/Transmitters/LMCTransmitter.hh index cda82c39..e9f925c6 100644 --- a/Source/Transmitters/LMCTransmitter.hh +++ b/Source/Transmitters/LMCTransmitter.hh @@ -36,9 +36,9 @@ namespace locust virtual void TxSayHello(); virtual bool Configure( const scarab::param_node& ){}; - virtual double* GetEFieldCoPol(int fieldPointIndex, double dt) {}; + virtual std::vector GetEFieldCoPol(int fieldPointIndex, double dt) {}; - virtual double* SolveKassFields(LMCThreeVector pointOfInterest, LMCThreeVector coPolDirection, double tReceiverTime, unsigned tTotalElementIndex) {}; + virtual std::vector SolveKassFields(LMCThreeVector pointOfInterest, LMCThreeVector coPolDirection, double tReceiverTime, unsigned tTotalElementIndex) {}; virtual void InitializeFieldPoint(LMCThreeVector fieldPoint); virtual bool IsKassiopeia() {return false;};