aboutsummaryrefslogtreecommitdiff
path: root/Source/Utils/WarpXUtil.cpp
diff options
context:
space:
mode:
authorGravatar MaxThevenet <mthevenet@lbl.gov> 2020-03-19 18:44:54 -0700
committerGravatar GitHub <noreply@github.com> 2020-03-19 18:44:54 -0700
commit9abcc85a384d4c51dac246679bc3a8270b98fb87 (patch)
tree1089aeb85ce80f215af53b4d632f7d8fbef5e7dc /Source/Utils/WarpXUtil.cpp
parent57011251fc0e5eac168e9a693c39ae6588db274c (diff)
downloadWarpX-9abcc85a384d4c51dac246679bc3a8270b98fb87.tar.gz
WarpX-9abcc85a384d4c51dac246679bc3a8270b98fb87.tar.zst
WarpX-9abcc85a384d4c51dac246679bc3a8270b98fb87.zip
Add capability to select fields to dump (#819)
* Start implementation of new averaging with staggering: - face-to-cell-center and edge-to-cell-center replaced so far; - TODO: node-to-cell-center and 1D behavior (AMREX_SPACEDIM=1). * first implementation of Diags base classes * add example, temporarily * Continue implementation of new averaging with staggering: - new function takes reference to single MultiFab (no vector); - TODO: node-to-cell-center still in progress. * Fix small bug and clean up * Fix bug in loop over n=0,...,ncomp-1 and clean up * add more functions * Add Doxygen documentation and clean up * Small clean-up in Doxygen documentation * Compile in single precision: add _rt suffix to avoid unnecessary conversions * Avoid accessing staggering index directly from IntVect in innermost loops * Replace do-while loop with for loop (default ncomp=1) * Remove temporary pointer and pass reference to MultiFab (instead of MultiFab*) * Replace AMREX_LAUNCH_HOST_DEVICE_LAMBDA with ParallelFor * cleaning and initialize output mf * use general average routine * move flush in new class, and implemented the Plotfile derived class * add comments * eol * free memory in destructor * typo * typo * no need to clear MF pointers there * though shalt not break existing tests * FlushRaw doesnt have to be virtual for now * The importance of being constant * Capability to select fields in output files * EOL * revert to old inputs * const in right place * avoid brace initializer there * oops, fix logic error in is_in * pass by const ref, as suggested by Andrew's review Co-authored-by: Edoardo Zoni <ezoni@lbl.gov>
Diffstat (limited to 'Source/Utils/WarpXUtil.cpp')
-rw-r--r--Source/Utils/WarpXUtil.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/Utils/WarpXUtil.cpp b/Source/Utils/WarpXUtil.cpp
index ddd3cf4b6..7340056fc 100644
--- a/Source/Utils/WarpXUtil.cpp
+++ b/Source/Utils/WarpXUtil.cpp
@@ -224,3 +224,26 @@ void AlwaysAssert(bool is_expression_true, const std::string& msg = "ERROR!")
}
}
+
+namespace WarpXUtilStr
+{
+ bool is_in(const std::vector<std::string>& vect,
+ const std::string& elem)
+ {
+ bool value = false;
+ if (std::find(vect.begin(), vect.end(), elem) != vect.end()){
+ value = true;
+ }
+ return value;
+ }
+
+ bool is_in(const std::vector<std::string>& vect,
+ const std::vector<std::string>& elems)
+ {
+ bool value = false;
+ for (auto elem : elems){
+ if (is_in(vect, elem)) value = true;
+ }
+ return value;
+ }
+}