-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Functionality for
Indexer
masking (#901)
* Start on in one AMR * Fix MPI bug * Make things work w/o MPI * small * update changelog * Make AMR helper functions free to alleviate compilation issues on GPU * Fix MPI compilation error * Actually compile with MPI... * Fix indexing bug * Remove unused vars * Fix indexing bug * Make things work for tensor variables * CellVariable to Variable * Respond to Philipp's comments * Maybe fix compiler issues * Second half of fix * Add fence back * Update copyright dates * Pass dealloc count when sending same to same * Almost working, but differs on step 301 after remesh * Add deletion check * Fix a bunch of bugs with a couple changes * Format, lint, changelog * Remove debugging MPI Barrier * Add maximum number of iterations for deletion check * Remove commented lines and clean up * Fix MPI AMR bug related to not passing dereference count when nothing is allocated on a block * format and lint * Fix bug when sparse is disabled * overloads to create packs with meshdata * Always apply fine boundary conditions * Split pack descriptor into separate header * Actually include meshdata and Meshblockdata * more includes * more includes * Reworking neighbor finding * Start on adding morton numbers * Make stuff private * format and lint * Add real comparison operators * Split out morton number * Fix bug when shift is larger than bit size * Add some more functionality to logical location * Start on unit test * Actually compare Morton numbers * Add neighbor check, untested * Fix TE neighbor finding and add tests * Update copyrights * Add logical location to NeighborBlock * add interleave constant test and fix bug * Add bit interleave test * update changelog * Explicitly start at zero * Add routines for calculating ownership and tests * Remove comments * Add another ownership test * Format and lint * Add mask and start testing * switch to bits * Separate logical location header * Switch to class * reserve * Seemingly working masking code * Somewhat more extensive tests * Add ownership to neighbor blocks * Update to mask and run over all indices, still some bug were some neighbor block ownership is not being set * Ownership model passing for cell centered vars * format and lint * Fix errors hidden by MPI ifdef * Remove printf * Add sparse seed nans flag to output * changelog * change signaling NaN to quiet NaN * format * format and lint * Deal with coarse to fine corner issue * changelog * Format and lint * Remove commented out code * Mask prolongation and restriction * Add MakePackDescriptor overload * Add possible neighbors on periodic boundaries * Deal with periodic boundaries * Explicitly deal with periodic vs non-periodic directions * format and lint * Actually pass base grid information * Act on Philipp's comments * Fix linter error --------- Co-authored-by: Philipp Grete <[email protected]> Co-authored-by: Jonah Maxwell Miller <[email protected]>
- Loading branch information
1 parent
badd6f4
commit 94caccd
Showing
24 changed files
with
482 additions
and
106 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
//======================================================================================== | ||
// (C) (or copyright) 2020-2023. Triad National Security, LLC. All rights reserved. | ||
// | ||
// This program was produced under U.S. Government contract 89233218CNA000001 for Los | ||
// Alamos National Laboratory (LANL), which is operated by Triad National Security, LLC | ||
// for the U.S. Department of Energy/National Nuclear Security Administration. All rights | ||
// in the program are reserved by Triad National Security, LLC, and the U.S. Department | ||
// of Energy/National Nuclear Security Administration. The Government is granted for | ||
// itself and others acting on its behalf a nonexclusive, paid-up, irrevocable worldwide | ||
// license in this material to reproduce, prepare derivative works, distribute copies to | ||
// the public, perform publicly and display publicly, and to permit others to do so. | ||
//======================================================================================== | ||
#ifndef INTERFACE_MAKE_PACK_DESCRIPTOR_HPP_ | ||
#define INTERFACE_MAKE_PACK_DESCRIPTOR_HPP_ | ||
|
||
#include <algorithm> | ||
#include <functional> | ||
#include <limits> | ||
#include <map> | ||
#include <memory> | ||
#include <regex> | ||
#include <set> | ||
#include <string> | ||
#include <tuple> | ||
#include <type_traits> | ||
#include <utility> | ||
#include <vector> | ||
|
||
#include "interface/mesh_data.hpp" | ||
#include "interface/meshblock_data.hpp" | ||
#include "interface/metadata.hpp" | ||
#include "interface/sparse_pack.hpp" | ||
#include "interface/state_descriptor.hpp" | ||
#include "mesh/mesh.hpp" | ||
|
||
namespace parthenon { | ||
|
||
inline auto MakePackDescriptor(StateDescriptor *psd, const std::vector<std::string> &vars, | ||
const std::vector<bool> &use_regex, | ||
const std::vector<MetadataFlag> &flags = {}, | ||
const std::set<PDOpt> &options = {}) { | ||
PARTHENON_REQUIRE(vars.size() == use_regex.size(), | ||
"Vargroup names and use_regex need to be the same size."); | ||
auto selector = [&](int vidx, const VarID &id, const Metadata &md) { | ||
if (flags.size() > 0) { | ||
for (const auto &flag : flags) { | ||
if (!md.IsSet(flag)) return false; | ||
} | ||
} | ||
|
||
if (use_regex[vidx]) { | ||
if (std::regex_match(std::string(id.label()), std::regex(vars[vidx]))) return true; | ||
} else { | ||
if (vars[vidx] == id.label()) return true; | ||
if (vars[vidx] == id.base_name && id.sparse_id != InvalidSparseID) return true; | ||
} | ||
return false; | ||
}; | ||
|
||
impl::PackDescriptor base_desc(psd, vars, selector, options); | ||
return typename SparsePack<>::Descriptor(base_desc); | ||
} | ||
|
||
template <class... Ts> | ||
inline auto MakePackDescriptor(StateDescriptor *psd, | ||
const std::vector<MetadataFlag> &flags = {}, | ||
const std::set<PDOpt> &options = {}) { | ||
static_assert(sizeof...(Ts) > 0, "Must have at least one variable type for type pack"); | ||
|
||
std::vector<std::string> vars{Ts::name()...}; | ||
std::vector<bool> use_regex{Ts::regex()...}; | ||
|
||
return typename SparsePack<Ts...>::Descriptor(static_cast<impl::PackDescriptor>( | ||
MakePackDescriptor(psd, vars, use_regex, flags, options))); | ||
} | ||
|
||
inline auto MakePackDescriptor(StateDescriptor *psd, const std::vector<std::string> &vars, | ||
const std::vector<MetadataFlag> &flags = {}, | ||
const std::set<PDOpt> &options = {}) { | ||
return MakePackDescriptor(psd, vars, std::vector<bool>(vars.size(), false), flags, | ||
options); | ||
} | ||
|
||
template <class... Ts> | ||
inline auto MakePackDescriptor(MeshBlockData<Real> *pmbd, | ||
const std::vector<MetadataFlag> &flags = {}, | ||
const std::set<PDOpt> &options = {}) { | ||
return MakePackDescriptor<Ts...>( | ||
pmbd->GetBlockPointer()->pmy_mesh->resolved_packages.get(), flags, options); | ||
} | ||
|
||
template <class... Ts> | ||
inline auto MakePackDescriptor(MeshData<Real> *pmd, | ||
const std::vector<MetadataFlag> &flags = {}, | ||
const std::set<PDOpt> &options = {}) { | ||
return MakePackDescriptor<Ts...>(pmd->GetMeshPointer()->resolved_packages.get(), flags, | ||
options); | ||
} | ||
|
||
template <class... Ts> | ||
inline auto MakePackDescriptor(SparsePack<Ts...> pack, StateDescriptor *psd, | ||
const std::vector<MetadataFlag> &flags = {}, | ||
const std::set<PDOpt> &options = {}) { | ||
return parthenon::MakePackDescriptor<Ts...>(psd, flags, options); | ||
} | ||
|
||
inline auto MakePackDescriptor( | ||
StateDescriptor *psd, const std::vector<std::pair<std::string, bool>> &var_regexes, | ||
const std::vector<MetadataFlag> &flags = {}, const std::set<PDOpt> &options = {}) { | ||
std::vector<std::string> vars; | ||
std::vector<bool> use_regex; | ||
for (const auto &[v, r] : var_regexes) { | ||
vars.push_back(v); | ||
use_regex.push_back(r); | ||
} | ||
return MakePackDescriptor(psd, vars, use_regex, flags, options); | ||
} | ||
|
||
} // namespace parthenon | ||
|
||
#endif // INTERFACE_MAKE_PACK_DESCRIPTOR_HPP_ |
Oops, something went wrong.