From 439778ccfe78856246de7cf225441f5919906c96 Mon Sep 17 00:00:00 2001 From: mawc2019 Date: Sat, 2 Apr 2022 17:42:28 -0400 Subject: [PATCH] correct a typo in srcpt_info_offsets and remove unnecessary register_src_time --- python/adjoint/objective.py | 4 +--- src/fix_boundary_sources.cpp | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/python/adjoint/objective.py b/python/adjoint/objective.py index 912944d9e..6a0316931 100644 --- a/python/adjoint/objective.py +++ b/python/adjoint/objective.py @@ -109,12 +109,10 @@ def _create_time_profile(self, fwidth_frac=0.1): The user may specify a scalar valued objective function across multiple frequencies (e.g. MSE) in which case we should check that all the frequencies fit in the specified bandwidth. """ - srct = mp.GaussianSource( + return mp.GaussianSource( np.mean(self._frequencies), fwidth=fwidth_frac * np.mean(self._frequencies), ) - self.sim.fields.register_src_time(srct.swigobj) - return srct class EigenmodeCoefficient(ObjectiveQuantity): diff --git a/src/fix_boundary_sources.cpp b/src/fix_boundary_sources.cpp index c3bdf86eb..f2f65dbe1 100644 --- a/src/fix_boundary_sources.cpp +++ b/src/fix_boundary_sources.cpp @@ -109,8 +109,8 @@ void fields::fix_boundary_sources() { #ifdef HAVE_MPI // declare an MPI datatype mirroring srcpt_info, so that we can send/receive srcpt_info arrays int srcpt_info_blocklengths[5] = {2,1,1,1,1}; - MPI_Datatype srcpt_info_types[5] = {MPI_DOUBLE, sizeof(ptrdiff_t) == 4 ? MPI_INT : MPI_LONG_LONG, sizeof(size_t) == 4 ? MPI_UNSIGNED : MPI_UNSIGNED_LONG_LONG, MPI_INT, MPI_INT}; - MPI_Aint srcpt_info_offsets[5] = { offsetof(srcpt_info,A), offsetof(srcpt_info,index), offsetof(srcpt_info,chunk_idx), offsetof(srcpt_info,src_time_id), offsetof(srcpt_info,c) }; + MPI_Datatype srcpt_info_types[5] = {MPI_DOUBLE, sizeof(ptrdiff_t) == sizeof(int) ? MPI_INT : MPI_LONG_LONG, sizeof(size_t) == sizeof(unsigned) ? MPI_UNSIGNED : MPI_UNSIGNED_LONG_LONG, MPI_INT, MPI_INT}; + MPI_Aint srcpt_info_offsets[5] = { offsetof(srcpt_info,A), offsetof(srcpt_info,index), offsetof(srcpt_info,src_time_id), offsetof(srcpt_info,chunk_idx), offsetof(srcpt_info,c) }; MPI_Datatype mpi_srcpt_info; MPI_Type_create_struct(5, srcpt_info_blocklengths, srcpt_info_offsets, srcpt_info_types, &mpi_srcpt_info); MPI_Type_commit(&mpi_srcpt_info);