-
Notifications
You must be signed in to change notification settings - Fork 41
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
FsGrid & fieldsolver refactoring #1099
Open
cscjlan
wants to merge
254
commits into
fmihpc:dev
Choose a base branch
from
cschpc:fsgrid_merge_without_override
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
…her changes due to clang-format
Note that some of the diffs are completely unintelligible due to Files:
This script creates a complete diff locally: #!/bin/bash
set -exu
git clone http://github.com/fmihpc/vlasiator.git
cd vlasiator/
git remote add csc https://github.com/cschpc/vlasiator.git
git fetch csc
git checkout -b clang-format-dev origin/dev
declare -a to_format=(
"datareduction/datareducer.cpp"
"fieldtracing/fieldtracing.cpp"
"fieldtracing/fieldtracing.h"
"grid.cpp"
"ioread.cpp"
"sysboundary/copysphere.cpp"
"sysboundary/inflow.cpp"
"sysboundary/ionosphere.cpp"
"sysboundary/outflow.cpp"
"tools/vlsvdiff.cpp"
)
for file in "${to_format[@]}"; do
clang-format --style=file:.clang-format -i "${file}"
done
git add .
git commit -m "format some files"
git diff HEAD csc/fsgrid_merge_without_override > git_diff Save in a file, execute it, then view the file |
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.
FsGrid
Vlasiator has been updated to use the refactored FsGrid. This is visible everywhere FsGrid was used in. Some notable differences are dicussed below.
First, there's only a single
FsGrid
object and it's calledfsgrid
. It no longer stores any data. The data that used to be stored by the different grids are now owned by a structure calledFsData
, one for each ex-grid. The data is not passed around by passing the FsData structures, but rather by passing anstd::span
. You can get anstd::span
fromFsData
with theview()
method:auto technicalSpan = technicalData.view();
updateGhostCells
now takes in anstd::span
:fsgrid.updateGhostCells(technical);
instead oftechnicalGrid.updateGhostCells()
.Data is no longer accessed through the
grid.get(i, j, k)
method, but rather by contructing anFsStencil
, and using it to compute a 1D index from a 3D index:This has the benefit that some values that are constant throughout the simulation can be computed once and stored in the fsgrid object. A single
FsStencil
is constructed for each iteration of a loop (i.e. one for each i, j, k). The constant values can be accessed by theFsStencil
when it computes the 1D value from the 3D index it was constructed with.Fieldsolver
Fieldsolver has been refactored to use the updated FsGrid. Some files have undergone heavier refactoring (
ldz_electric_field.cpp
), some less heavy. The underlying reason for all of the refactoring is to make it easier to change the fieldsolver to use the updated FsGrid: with less code repetition there's less work to be done (and thus fewer bugs) when changing the code to use the stencil and the spans. An additional benefit was a speed up especially in the electric field computation.derivatives.cpp
andldz_volume.cpp
use the newly addedfsgrid.parallel_for
, which is an architecture/processor independent way of doing the desired computation. It takes in a lambda, which it calls for each local cell on the fsgrid.