import type { FunctionalComponent } from 'preact';
import { h, Fragment } from 'preact';
import { useState, useEffect, useRef } from 'preact/hooks';

const TableOfContents: FunctionalComponent<{ headers: any[] }> = ({ headers = [] }) => {
	const itemOffsets = useRef([]);
	const [activeId, setActiveId] = useState<string>(undefined);

	useEffect(() => {
		const getItemOffsets = () => {
			const titles = document.querySelectorAll('article :is(h1, h2, h3, h4)');
			itemOffsets.current = Array.from(titles).map((title) => ({
				id: title.id,
				topOffset: title.getBoundingClientRect().top + window.scrollY,
			}));
		};

		getItemOffsets();
		window.addEventListener('resize', getItemOffsets);

		return () => {
			window.removeEventListener('resize', getItemOffsets);
		};
	}, []);

	return (
		<>
			<h2 class="heading">On this page</h2>
			<ul>
				<li class={`header-link depth-2 ${activeId === 'overview' ? 'active' : ''}`.trim()}>
					<a href="#overview">Overview</a>
				</li>
				{headers
					.filter(({ depth }) => depth > 1 && depth < 4)
					.map((header) => (
						<li
							class={`header-link depth-${header.depth} ${
								activeId === header.slug ? 'active' : ''
							}`.trim()}
						>
							<a href={`#${header.slug}`}>{header.text}</a>
						</li>
					))}
			</ul>
		</>
	);
};

export default TableOfContents;
hon/WarpX_py.cpp?id=581510ffdd5134700fb30bbab3eb8abc294d9ab7'>tree</a><a href='/ansg191/WarpX/commit/Source/Python/WarpX_py.cpp?id=581510ffdd5134700fb30bbab3eb8abc294d9ab7&amp;follow=1'>commit</a><a href='/ansg191/WarpX/diff/Source/Python/WarpX_py.cpp?id=581510ffdd5134700fb30bbab3eb8abc294d9ab7&amp;follow=1'>diff</a></td><td class='form'><form class='right' method='get' action='/ansg191/WarpX/log/Source/Python/WarpX_py.cpp'>
<input type='hidden' name='id' value='581510ffdd5134700fb30bbab3eb8abc294d9ab7'/><input type='hidden' name='showmsg' value='1'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/ansg191/WarpX/log/?id=581510ffdd5134700fb30bbab3eb8abc294d9ab7&amp;showmsg=1&amp;follow=1'>root</a>/<a href='/ansg191/WarpX/log/Source?id=581510ffdd5134700fb30bbab3eb8abc294d9ab7&amp;showmsg=1&amp;follow=1'>Source</a>/<a href='/ansg191/WarpX/log/Source/Python?id=581510ffdd5134700fb30bbab3eb8abc294d9ab7&amp;showmsg=1&amp;follow=1'>Python</a>/<a href='/ansg191/WarpX/log/Source/Python/WarpX_py.cpp?id=581510ffdd5134700fb30bbab3eb8abc294d9ab7&amp;showmsg=1&amp;follow=1'>WarpX_py.cpp</a> (<a href='/ansg191/WarpX/log/Source/Python/WarpX_py.cpp?id=581510ffdd5134700fb30bbab3eb8abc294d9ab7&amp;showmsg=1'>unfollow</a>)</div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/ansg191/WarpX/log/Source/Python/WarpX_py.cpp?id=581510ffdd5134700fb30bbab3eb8abc294d9ab7&amp;follow=1'>Collapse</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr>
<tr class='logheader'><td><span title='2019-05-01 16:24:01 -0700'>2019-05-01</span></td><td class='logsubject'><a href='/ansg191/WarpX/commit/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp?id=52cf65054064f6c2853cd9cfd1bb3378977eda5d&amp;follow=1'>Fix normalization</a></td><td><img src='//www.gravatar.com/avatar/b7f8ef466264fedde82bcf5e13962aee?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Remi Lehe
</td><td>1</td><td><span class='deletions'>-6</span>/<span class='insertions'>+8</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2019-05-01 16:22:40 -0700'>2019-05-01</span></td><td class='logsubject'><a href='/ansg191/WarpX/commit/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp?id=e1c6d7c7850adfdd12a01155f74f42275502d54b&amp;follow=1'>Implement Real-to-complex FFT</a></td><td><img src='//www.gravatar.com/avatar/b7f8ef466264fedde82bcf5e13962aee?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Remi Lehe
</td><td>4</td><td><span class='deletions'>-30</span>/<span class='insertions'>+56</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2019-04-30 15:09:28 -0700'>2019-04-30</span></td><td class='logsubject'><a href='/ansg191/WarpX/commit/Tools/read_raw_data.py?id=c046858a1cad4afc62d6fc763faa083cfb6e1309&amp;follow=1'>update read_raw_data.py to do the write thing whether or not each fab has a ↵</a></td><td><img src='//www.gravatar.com/avatar/e6418cddfaf93e23caa06ba3ab1d7024?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Andrew Myers
</td><td>1</td><td><span class='deletions'>-2</span>/<span class='insertions'>+4</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
header


</td></tr>
<tr class='logheader'><td><span title='2019-04-30 13:38:35 -0700'>2019-04-30</span></td><td class='logsubject'><a href='/ansg191/WarpX/commit/Source/WarpX.cpp?id=7ac906e7171138ae3fa850c0d52cad925379c4d7&amp;follow=1'>Allow to plot the fine mesh, even with only one level</a></td><td><img src='//www.gravatar.com/avatar/b7f8ef466264fedde82bcf5e13962aee?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Remi Lehe
</td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+1</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2019-04-29 16:02:24 -0700'>2019-04-29</span></td><td class='logsubject'><a href='/ansg191/WarpX/commit/Source/Particles/MultiParticleContainer.cpp?id=deea0e1b3b96ac6f2ffc9a206f8f07f229c216ba&amp;follow=1'>fix typo</a></td><td><img src='//www.gravatar.com/avatar/e6418cddfaf93e23caa06ba3ab1d7024?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Andrew Myers
</td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+1</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2019-04-29 15:56:37 -0700'>2019-04-29</span></td><td class='logsubject'><a href='/ansg191/WarpX/commit/Source/Particles/MultiParticleContainer.cpp?id=0cff28db0a8b9125fa18a7b604eb97070377a26a&amp;follow=1'>fix number of particle containers due to upstream changes</a></td><td><img src='//www.gravatar.com/avatar/e6418cddfaf93e23caa06ba3ab1d7024?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Andrew Myers
</td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+1</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2019-04-29 13:56:04 -0700'>2019-04-29</span></td><td class='logsubject'><a href='/ansg191/WarpX/commit/Python/pywarpx/picmi.py?id=68f260b3eb72178ebf9c2f4135af43d0dc687d2b&amp;follow=1'>Implemented multiple antennas in picmi</a></td><td><img src='//www.gravatar.com/avatar/553c1ee3ed71c854378f0c1ed9a238df?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Dave Grote
</td><td>6</td><td><span class='deletions'>-21</span>/<span class='insertions'>+39</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2019-04-29 13:05:57 -0700'>2019-04-29</span></td><td class='logsubject'><a href='/ansg191/WarpX/commit/Source/FieldSolver/SpectralSolver/SpectralFieldData.H?id=ce517d68ee28cf4870a4f84963682284a7513d14&amp;follow=1'>Revert to enumeration in struct</a></td><td><img src='//www.gravatar.com/avatar/b7f8ef466264fedde82bcf5e13962aee?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Remi Lehe
</td><td>1</td><td><span class='deletions'>-3</span>/<span class='insertions'>+4</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2019-04-29 12:45:06 -0700'>2019-04-29</span></td><td class='logsubject'><a href='/ansg191/WarpX/commit/Source/Particles/WarpXParticleContainer.cpp?id=9fec75fc1dcf8941a7a5012c50b2bd727ccfcdcf&amp;follow=1'>make sure we initialize the new particle components for all the different ↵</a></td><td><img src='//www.gravatar.com/avatar/e6418cddfaf93e23caa06ba3ab1d7024?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Andrew Myers
</td><td>2</td><td><span class='deletions'>-0</span>/<span class='insertions'>+29</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
paths for particle initialization


</td></tr>
<tr class='logheader'><td><span title='2019-04-29 12:44:08 -0700'>2019-04-29</span></td><td class='logsubject'><a href='/ansg191/WarpX/commit/Source/WarpX.cpp?id=32f3c8f55dfbe7efcf17ba97c0cd4a9fb1246b0f&amp;follow=1'>make sure we pass the right number of flags into the WritePlotFile routine</a></td><td><img src='//www.gravatar.com/avatar/e6418cddfaf93e23caa06ba3ab1d7024?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Andrew Myers
</td><td>1</td><td><span class='deletions'>-2</span>/<span class='insertions'>+16</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2019-04-29 12:05:29 -0700'>2019-04-29</span></td><td class='logsubject'><a href='/ansg191/WarpX/commit/Source/FieldSolver/SpectralSolver/PsatdAlgorithm.cpp?id=1cd46dbcb84fc19e6595fe02a473da43c41cb080&amp;follow=1'>Update PSATD algorithm</a></td><td><img src='//www.gravatar.com/avatar/b7f8ef466264fedde82bcf5e13962aee?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Remi Lehe
</td><td>1</td><td><span class='deletions'>-31</span>/<span class='insertions'>+21</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2019-04-29 12:01:12 -0700'>2019-04-29</span></td><td class='logsubject'><a href='/ansg191/WarpX/commit/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp?id=ba4cb44e38be3f1e8b1cd5f0c34966044db082b5&amp;follow=1'>Update structure for storing spectral fields</a></td><td><img src='//www.gravatar.com/avatar/b7f8ef466264fedde82bcf5e13962aee?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Remi Lehe
</td><td>2</td><td><span class='deletions'>-48</span>/<span class='insertions'>+18</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2019-04-29 10:41:06 -0700'>2019-04-29</span></td><td class='logsubject'><a href='/ansg191/WarpX/commit/Source/Particles/RigidInjectedParticleContainer.cpp?id=7e58007c9eba2b51003ff813a8bfe65ae25e8392&amp;follow=1'>replace the compile time checks used for the old particle attributes with ↵</a></td><td><img src='//www.gravatar.com/avatar/e6418cddfaf93e23caa06ba3ab1d7024?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Andrew Myers
</td><td>2</td><td><span class='deletions'>-47</span>/<span class='insertions'>+52</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
runtime ones


</td></tr>
<tr class='logheader'><td><span title='2019-04-29 10:30:35 -0700'>2019-04-29</span></td><td class='logsubject'><a href='/ansg191/WarpX/commit/Source/Particles/WarpXParticleContainer.cpp?id=0f9a768a10529ea0b3e9d9dde12834f31bc733cd&amp;follow=1'>set up particle comps ids if using boosted frame particles</a></td><td><img src='//www.gravatar.com/avatar/e6418cddfaf93e23caa06ba3ab1d7024?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Andrew Myers
</td><td>1</td><td><span class='deletions'>-0</span>/<span class='insertions'>+11</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2019-04-29 10:29:40 -0700'>2019-04-29</span></td><td class='logsubject'><a href='/ansg191/WarpX/commit/Source/Diagnostics/WarpXIO.cpp?id=f69a7ab8b04492cc1c104b36b23b21eda7dfdbb9&amp;follow=1'>add the old positions and momenta to the particle plotvar names if they are used</a></td><td><img src='//www.gravatar.com/avatar/e6418cddfaf93e23caa06ba3ab1d7024?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Andrew Myers
</td><td>1</td><td><span class='deletions'>-9</span>/<span class='insertions'>+10</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2019-04-29 10:18:34 -0700'>2019-04-29</span></td><td class='logsubject'><a href='/ansg191/WarpX/commit/Source/Particles/WarpXParticleContainer.cpp?id=c38f60ee1fe22ae21f9bc38a7d4ff5b1be2d2d5a&amp;follow=1'>add the xold, uxold, etc particle components at runtime if doing boosted ↵</a></td><td><img src='//www.gravatar.com/avatar/e6418cddfaf93e23caa06ba3ab1d7024?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Andrew Myers
</td><td>3</td><td><span class='deletions'>-13</span>/<span class='insertions'>+53</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
frame diagnostics for the particles


</td></tr>
<tr class='logheader'><td><span title='2019-04-29 10:16:37 -0700'>2019-04-29</span></td><td class='logsubject'><a href='/ansg191/WarpX/commit/Tools/performance_tests/GNUmakefile_perftest?id=d6d9c796040e14dc0fe50e96bc2b1231d953a01e&amp;follow=1'>remove the compilation flag for STORE_OLD_PARTICLE_ATTRIBS - this can be ↵</a></td><td><img src='//www.gravatar.com/avatar/e6418cddfaf93e23caa06ba3ab1d7024?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Andrew Myers
</td><td>5</td><td><span class='deletions'>-24</span>/<span class='insertions'>+11</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
done at runtime now


</td></tr>
<tr class='logheader'><td><span title='2019-04-28 14:52:39 -0700'>2019-04-28</span></td><td class='logsubject'><a href='/ansg191/WarpX/commit/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp?id=cc5a3f63f879b93ff67ff11084da85b615f338af&amp;follow=1'>Fix more 2D bugs</a></td><td><img src='//www.gravatar.com/avatar/b7f8ef466264fedde82bcf5e13962aee?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Remi Lehe
</td><td>1</td><td><span class='deletions'>-2</span>/<span class='insertions'>+7</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2019-04-28 14:32:57 -0700'>2019-04-28</span></td><td class='logsubject'><a href='/ansg191/WarpX/commit/Source/FieldSolver/WarpXFFT.cpp?id=a75f2ac4a0870440a6825e8b05efbca0d4b03e43&amp;follow=1'>Fix 2D bugs</a></td><td><img src='//www.gravatar.com/avatar/b7f8ef466264fedde82bcf5e13962aee?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Remi Lehe
</td><td>2</td><td><span class='deletions'>-3</span>/<span class='insertions'>+10</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2019-04-28 10:35:31 -0700'>2019-04-28</span></td><td class='logsubject'><a href='/ansg191/WarpX/commit/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp?id=178d50896b3da55874d8601934341c725ce041d6&amp;follow=1'>Fix error in calculation of modified k vectors</a></td><td><img src='//www.gravatar.com/avatar/b7f8ef466264fedde82bcf5e13962aee?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Remi Lehe
</td><td>1</td><td><span class='deletions'>-2</span>/<span class='insertions'>+3</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
