blob: 1a108b54b56ed3149dba2f0cf458236f67227160 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
/* Copyright 2020 Axel Huebl
*
* This file is part of WarpX.
*
* License: BSD-3-Clause-LBNL
*/
#include "RelativeCellPosition.H"
#include <AMReX_Config.H>
#include <AMReX_IndexType.H>
#include <AMReX_MultiFab.H>
std::vector< double >
utils::getRelativeCellPosition(amrex::MultiFab const& mf)
{
amrex::IndexType const idx_type = mf.ixType();
std::vector< double > relative_position(AMREX_SPACEDIM, 0.0);
// amrex::CellIndex::CELL means: 0.5 from lower corner for that index/direction
// amrex::CellIndex::NODE means: at corner for that index/direction
// WarpX::grid_type==GridType::Collocated means: all indices/directions on CellIndex::NODE
for (int d = 0; d < AMREX_SPACEDIM; d++)
{
if (idx_type.cellCentered(d))
relative_position.at(d) = 0.5;
}
return relative_position;
}
|