Skip to content

Commit 2eec4eb

Browse files
committed
Remove copyFrom constructor, now that copy semantics are working (#417)
This was just needed because copy/move semantics were broken originally.
1 parent 140cd68 commit 2eec4eb

3 files changed

Lines changed: 3 additions & 34 deletions

File tree

src/vmecpp/cpp/vmecpp/vmec/fourier_geometry/fourier_geometry.cc

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -351,35 +351,6 @@ void FourierGeometry::extrapolateTowardsAxis() {
351351
} // n
352352
}
353353

354-
void FourierGeometry::copyFrom(const FourierGeometry& src) {
355-
for (int jF = nsMin_; jF < nsMax_; ++jF) {
356-
for (int m = 0; m < s_.mpol; ++m) {
357-
for (int n = 0; n < s_.ntor + 1; ++n) {
358-
int idx_fc = ((jF - nsMin_) * s_.mpol + m) * (s_.ntor + 1) + n;
359-
360-
rmncc[idx_fc] = src.rmncc[idx_fc];
361-
zmnsc[idx_fc] = src.zmnsc[idx_fc];
362-
lmnsc[idx_fc] = src.lmnsc[idx_fc];
363-
if (s_.lthreed) {
364-
rmnss[idx_fc] = src.rmnss[idx_fc];
365-
zmncs[idx_fc] = src.zmncs[idx_fc];
366-
lmncs[idx_fc] = src.lmncs[idx_fc];
367-
}
368-
if (s_.lasym) {
369-
rmnsc[idx_fc] = src.rmnsc[idx_fc];
370-
zmncc[idx_fc] = src.zmncc[idx_fc];
371-
lmncc[idx_fc] = src.lmncc[idx_fc];
372-
if (s_.lthreed) {
373-
rmncs[idx_fc] = src.rmncs[idx_fc];
374-
zmnss[idx_fc] = src.zmnss[idx_fc];
375-
lmnss[idx_fc] = src.lmnss[idx_fc];
376-
}
377-
}
378-
} // n
379-
} // m
380-
} // j
381-
}
382-
383354
void FourierGeometry::ComputeSpectralWidth(
384355
const FourierBasisFastPoloidal& fourier_basis,
385356
RadialProfiles& m_radial_profiles, const int p, const int q) const {

src/vmecpp/cpp/vmecpp/vmec/fourier_geometry/fourier_geometry.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ class FourierGeometry : public FourierCoeffs {
4141

4242
void extrapolateTowardsAxis();
4343

44-
void copyFrom(const FourierGeometry &src);
45-
4644
// Compute the spectral width of the R and Z Fourier coefficients
4745
// and write it into the spectral_width vector in the given RadialProfiles.
4846
void ComputeSpectralWidth(const FourierBasisFastPoloidal &fourier_basis,

src/vmecpp/cpp/vmecpp/vmec/vmec/vmec.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ void Vmec::RestartIteration(double& m_delt0r, int thread_id) {
10341034
decomposed_v_[thread_id]->setZero();
10351035

10361036
// restore state from backup
1037-
decomposed_x_[thread_id]->copyFrom(*physical_x_backup_[thread_id]);
1037+
*decomposed_x_[thread_id] = *physical_x_backup_[thread_id];
10381038

10391039
#ifdef _OPENMP
10401040
#pragma omp barrier
@@ -1063,7 +1063,7 @@ void Vmec::RestartIteration(double& m_delt0r, int thread_id) {
10631063
decomposed_v_[thread_id]->setZero();
10641064

10651065
// restore state from backup
1066-
decomposed_x_[thread_id]->copyFrom(*physical_x_backup_[thread_id]);
1066+
*decomposed_x_[thread_id] = *physical_x_backup_[thread_id];
10671067

10681068
#ifdef _OPENMP
10691069
#pragma omp barrier
@@ -1083,7 +1083,7 @@ void Vmec::RestartIteration(double& m_delt0r, int thread_id) {
10831083
// save current state vector, e.g. restart_reason == NO_RESTART
10841084

10851085
// update backup
1086-
physical_x_backup_[thread_id]->copyFrom(*decomposed_x_[thread_id]);
1086+
*physical_x_backup_[thread_id] = *decomposed_x_[thread_id];
10871087
}
10881088
#ifdef _OPENMP
10891089
#pragma omp barrier

0 commit comments

Comments
 (0)