Handling sources in the python interface #202
Open
jmllorens wants to merge 6 commits intoHomerReid:masterfrom
Open
Handling sources in the python interface #202jmllorens wants to merge 6 commits intoHomerReid:masterfrom
jmllorens wants to merge 6 commits intoHomerReid:masterfrom
Conversation
Solves the problem of CachedIF to get a copy of PW and the Omega from the parent class IncField.
Use dynamic cast to determine whether IF is PW or PS.
Now the results of a PointSource in an interior domain are the same for python and for scatter-scuff.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In issue #195 I found some problems to get the same results between
GetPFTandscuff-scatter. After digging into the problem, the current fix ensures the same result for dipoles and plane wave sources.Description of the main changes:
libs/libIncField/IncField.cc
IncField::IncField(const IncField &IF)IFtoCachedIFinscuffSolver.ccThe attributes of the base classIncFieldwhere not copied whennew PlaneWave(*PW)ornew PointSource(*PS).RegionLabelof the new object created bynew PlaneWaveornew PointSourcewas not initialized to aNULLpointer as theIncFieldconstructor demands, but was pointing to random memory positions. Therefore lineIncField.cc:89contains the assignmentRegionLabel=NULL.libs/libIncField/PointSource.cc
PointSource::PointSource(const PointSource &PS) : IncField(PS)libs/libIncField/PlaneWave.cc
PlaneWave::PlaneWave(const PlaneWave &PW) : IncField(PW)SetRegionLabelasRegionLabelis an attribute ofIncFieldlibs/libIncField/libIncField.h
IncField(const IncField &IF);libs/libscuff/AssembleRHSVector.cc
PointSourcerequires to know theRegionLabelif the dipole is inside of a scatterer:IF->RegionLabel = strdupEC(RegionLabels[IF->RegionIndex]);libs/libscuffSolver/scuffSolver.cc
With this code,
CachedIFends up always being aPointSourcePlaneWave *PW = (PlaneWave *) IF; if (PW) CachedIF=new PlaneWave(*PW); PointSource *PS = (PointSource *) IF; if (PS) CachedIF=new PointSource(*PS);The way I found to fix the copy of the source type is through dynamic casting:
The compiled binaries passes the Mie test.