diff options
author | 2020-09-08 09:53:02 -0700 | |
---|---|---|
committer | 2020-09-08 09:53:02 -0700 | |
commit | d3deb238aee2fca44a099ec45c08dc265223ca52 (patch) | |
tree | 6813c6f0a47f4282b9d0c7aca94925cbd633db05 /Source/Utils/RelativeCellPosition.H | |
parent | b452f85552c7fe07289f8e1033b7a8b631744eb5 (diff) | |
download | WarpX-d3deb238aee2fca44a099ec45c08dc265223ca52.tar.gz WarpX-d3deb238aee2fca44a099ec45c08dc265223ca52.tar.zst WarpX-d3deb238aee2fca44a099ec45c08dc265223ca52.zip |
openPMD: Generalize Mesh Position (#1296)
This adds a small utility that returns the relative in-cell position of values
on each cell depending on an `amrex::MultiFab`'s `Box`'s `IndexType`.
This does not change the output of openPMD yet, since we spatially and
temporally center fields before output, but makes the routines
more general overall for future use.
Diffstat (limited to '')
-rw-r--r-- | Source/Utils/RelativeCellPosition.H | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Source/Utils/RelativeCellPosition.H b/Source/Utils/RelativeCellPosition.H new file mode 100644 index 000000000..15ec06707 --- /dev/null +++ b/Source/Utils/RelativeCellPosition.H @@ -0,0 +1,31 @@ +/* Copyright 2020 Axel Huebl + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ +#ifndef WARPX_RELATIVE_CELL_POSITION_H_ +#define WARPX_RELATIVE_CELL_POSITION_H_ + +#include "WarpX.H" + +#include <AMReX_MultiFab.H> + +#include <vector> + + +namespace utils +{ + /** Get the Relative Cell Position of Values in an MultiFab + * + * Translate the IndexType of a given MultiFab into a position relative to + * the lower corner of a cell. + * + * @param[in] mf the amrex::MultiFab to get relative cell positions for + * @return relative position to the lower corner, scaled to cell size [0.0:1.0) + */ + std::vector< double > + getRelativeCellPosition (amrex::MultiFab const& mf); +} + +#endif // WARPX_RELATIVE_CELL_POSITION_H_ |