Skip to content

Commit

Permalink
correct a typo in srcpt_info_offsets and remove unnecessary register_…
Browse files Browse the repository at this point in the history
…src_time
  • Loading branch information
mawc2019 committed Apr 2, 2022
1 parent 3b649d4 commit 439778c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions python/adjoint/objective.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions src/fix_boundary_sources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 439778c

Please sign in to comment.