Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New FsGrid operators and lerp method #21

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

kstppd
Copy link
Contributor

@kstppd kstppd commented Nov 29, 2021

-This PR implements new operators for FsGrid .
-Now one can use +, -,+=,-=,*,*=,/,/= with FsGrid data structures.
-There is also a new lerp_t method which linearly interpolates between two existing FsGrids. It can be used like this:
-This PR also updates the tests so handles #20 and that can be closed if you want.

  FsGrid<std::array<Real, 10>, 2> res=lerp_t(A,B,t_a,t_b,t);

where

  • A,B are FsGrids of same signature
  • t_a,t_b are timestamps that corespond to A and B
  • t is the timestamp of the interpolated FsGrid res

I have implemented a few ways to make it more safe. For example we do not want to add a string to a perB field I guess :D
I also have a new test test/operators.cpp that demos some of the added functionality.
I will be doing more tests to catch any bugs or edge cases. So this is WIP.
Let me know what you think and what I should change :)

@kstppd kstppd changed the title New FsGrids operators and t_lerp method New FsGrid operators and t_lerp method Nov 29, 2021
@kstppd kstppd changed the title New FsGrid operators and t_lerp method New FsGrid operators and lerp method Nov 29, 2021
Copy link
Contributor

@ursg ursg left a comment

Choose a reason for hiding this comment

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

This looks pretty nice! Also, this is a wonderful step in the direction of a fully vectorized fieldsolver implmentation (although I dread the day that anyone of us would have to reformulate the hall component expressions into a new syntax).

Are there any simple parts of the fieldsolver where this could be directly taken into use, just to compare the performance?

fsgrid.hpp Outdated Show resolved Hide resolved
fsgrid.hpp Show resolved Hide resolved
fsgrid.hpp Show resolved Hide resolved
fsgrid.hpp Outdated Show resolved Hide resolved
fsgrid.hpp Outdated Show resolved Hide resolved
@markusbattarbee
Copy link
Contributor

Appears to run, and the interpolation at least doesn't break testpackage runs completely :)
However, note that the tests/operators.cpp interpolation test still uses the old interface of three time values.

@kstppd
Copy link
Contributor Author

kstppd commented Dec 1, 2021

@markusbattarbee Right Markus I forgot to push the changes to that so it does not even compile now. Will be fixed in the next push that has a few more operators coming

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.

4 participants