Skip to content

Add atError when kz=0 in gwig.c#1085

Merged
SebastienJoly merged 2 commits into
masterfrom
Fix_kz_wiggler
Jun 4, 2026
Merged

Add atError when kz=0 in gwig.c#1085
SebastienJoly merged 2 commits into
masterfrom
Fix_kz_wiggler

Conversation

@SebastienJoly

@SebastienJoly SebastienJoly commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

I added some safeguards in the gwig.c integrator following the discussion in: #1075
It raises an atError whenever a wiggler with kz=0 (in By or Bx) is called.

I am not sure whether I should call check_error() after atError(). What would you recommend?

@SebastienJoly SebastienJoly requested a review from lfarv June 4, 2026 08:21
@SebastienJoly SebastienJoly linked an issue Jun 4, 2026 that may be closed by this pull request
@SebastienJoly SebastienJoly requested a review from swhite2401 June 4, 2026 08:48

@swhite2401 swhite2401 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok!

@SebastienJoly SebastienJoly marked this pull request as ready for review June 4, 2026 12:55
@SebastienJoly SebastienJoly merged commit 2735e8e into master Jun 4, 2026
22 checks passed
@lfarv

lfarv commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Unfortunately, your test is done after the element structure is allocated, and so it creates a memory leak: the structure will never be released. It should be moved inside trackFunction (see #1075 (comment)) and executed before the line

Elem = (struct elem*)atMalloc(sizeof(struct elem));

and with a check_error().

(Sorry, I had no time to review yesterday…)

@swhite2401

Copy link
Copy Markdown
Contributor

Oups I missed that...I went to fast on that one.... thanks @lfarv!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

at.Wiggler does not handle kz=0

3 participants