inciter::Refiner class

Mesh refiner for interfacing the mesh refinement library.

Public types

enum class RefMode: std::size_t { T0REF = 1, DTREF, OUTREF, OUTDEREF }
Mode of operation: the way Refiner is used.

Constructors, destructors, conversion operators

Refiner(std::size_t meshid, const CProxy_Transporter& transporter, const CProxy_Sorter& sorter, const tk::CProxy_MeshWriter& meshwriter, const std::vector<Scheme>& scheme, const tk::RefinerCallback& cbr, const tk::SorterCallback& cbs, const std::vector<std::size_t>& ginpoel, const tk::UnsMesh::CoordMap& coordmap, const std::map<int, std::vector<std::size_t>>& bface, const std::vector<std::size_t>& triinpoel, const std::map<int, std::vector<std::size_t>>& bnode, const std::vector<std::size_t>& elemblid, int nchare) explicit
Constructor.
Refiner(CkMigrateMessage*) explicit
Migrate constructor.

Public functions

void query(int fromch, const EdgeSet& edges)
Incoming query for a list boundary edges for which this chare compiles shared edges.
void recvquery()
Receive receipt of boundary edge lists to quer.
void response()
Respond to boundary edge list queries.
void bnd(int fromch, const std::vector<int>& chares)
Receive shared boundary edges for our mesh chunk.
void recvbnd()
Receive receipt of shared boundary edges.
void reorder()
Query Sorter and update local mesh with the reordered one.
void start()
Start new step of initial mesh refinement/derefinement.
void next()
Continue after finishing a refinemen/derefinementt step.
void dtref(const std::map<int, std::vector<std::size_t>>& bface, const std::map<int, std::vector<std::size_t>>& bnode, const std::vector<std::size_t>& triinpoel)
Start mesh refinement (during time stepping, t>0)
void outref(const std::map<int, std::vector<std::size_t>>& bface, const std::map<int, std::vector<std::size_t>>& bnode, const std::vector<std::size_t>& triinpoel, CkCallback c, RefMode mode = RefMode::OUTREF)
Start mesh refinement (for field output)
void refine()
Do a single step of mesh refinemen/derefinementt (only tag edges)
void addRefBndEdges(int fromch, const AMR::EdgeData& ed, const std::unordered_set<size_t>& intermediates)
Receive newly added mesh edges and locks on our chare boundary.
void correctref()
Correct refinement to arrive at conforming mesh across chare boundaries.
void comExtra()
Communicate refined edges after a refinement/derefinement step.
void perform()
Perform mesh refinement and decide how to continue.
void sendProxy()
Send Refiner proxy to Discretization objects.
auto refinementFields() const -> std::tuple<std::vector<std::string>, std::vector<std::vector<tk::real>>, std::vector<std::string>, std::vector<std::vector<tk::real>>>
Get refinement field data in mesh cells.

Charm++ pack/unpack serializer member functions

std::size_t m_meshid
Mesh ID.
std::size_t m_ncit
Number of parallel-compatibility (mesh ref correction) iterations.
CProxy_Transporter m_host
Host proxy.
CProxy_Sorter m_sorter
Mesh sorter proxy.
tk::CProxy_MeshWriter m_meshwriter
Mesh writer proxy.
std::vector<Scheme> m_scheme
Discretization schemes (one per mesh)
tk::RefinerCallback m_cbr
Charm++ callbacks associated to compile-time tags for refiner.
tk::SorterCallback m_cbs
Charm++ callbacks associated to compile-time tags for sorter.
std::vector<std::size_t> m_ginpoel
Tetrtahedron element connectivity of our chunk of the mesh (global ids)
tk::UnsMesh::Chunk m_el
std::vector<std::size_t>& m_inpoel
Alias to element connectivity with local node IDs in m_el.
std::vector<std::size_t>& m_gid
Alias to global node IDs of owned elements in m_el.
std::unordered_map<std::size_t, std::size_t>& m_lid
Alias to local node IDs associated to the global ones of owned elements in m_el.
tk::UnsMesh::CoordMap m_coordmap
Coordinates associated to global node IDs of our mesh chunk.
tk::UnsMesh::Coords m_coord
Coordinates of mesh nodes of our chunk of the mesh.
std::map<int, std::vector<std::size_t>> m_bface
List of boundary faces associated to side-set IDs.
std::map<int, std::vector<std::size_t>> m_bnode
List of boundary nodes associated to side-set IDs.
std::vector<std::size_t> m_triinpoel
Boundary face-node connectivity.
std::unordered_map<std::size_t, std::set<std::size_t>> m_elemblockid
Mesh block ids associated with local tet ids.
int m_nchare
Total number of refiner chares.
RefMode m_mode
True if initial AMR, false if during time stepping.
std::vector<ctr::AMRInitialType> m_initref
Initial mesh refinement type list (in reverse order)
std::size_t m_ninitref
Number of initial mesh refinement/derefinement steps.
AMR::mesh_adapter_t m_refiner
Mesh refiner (library) object.
std::size_t m_nref
Counter during distribution of newly added nodes to chare-boundary edges.
std::size_t m_nbnd
Counter for number of chares contributing to chare boundary edges.
std::size_t m_extra
Number of chare-boundary newly added nodes that need correction.
std::unordered_set<int> m_ch
Chares we share at least a single edge with.
std::unordered_map<Edge, std::vector<int>, Hash<2>, Eq<2>> m_edgech
Edge->chare map used to build shared boundary edges.
std::unordered_map<int, EdgeSet> m_chedge
Chare->edge map used to build shared boundary edges.
AMR::EdgeData m_localEdgeData
Refinement data associated to edges (edges stored with node-gids)
std::unordered_map<int, std::vector<std::tuple<Edge, int, int, AMR::Edge_Lock_Case>>> m_remoteEdgeData
Refinement data associated to edges shared with other chares (edges stored with node-gids)
std::unordered_map<int, std::vector<Edge>> m_remoteEdges
Edges received from other chares.
std::unordered_set<size_t> m_intermediates
Intermediate nodes.
tk::NodeCommMap m_nodeCommMap
Global mesh node IDs bordering the mesh chunk held by fellow worker chares associated to their chare IDs for the coarse mesh.
TetSet m_oldTets
Tetrahedra before refinement/derefinement step.
std::unordered_map<std::size_t, Edge> m_addedNodes
Newly added mesh nodes (local id) and their parents (local ids)
std::unordered_map<std::size_t, std::size_t> m_addedTets
Newly added mesh cells (local id) and their parent (local id)
std::set<std::size_t> m_removedNodes
Newly removed mesh node local ids.
std::unordered_map<std::size_t, std::size_t> m_amrNodeMap
Node id maps from old mesh to new refined mesh.
std::size_t m_oldntets
Number of tetrahedra in the mesh before refinement/derefinement step.
std::unordered_map<int, FaceSet> m_coarseBndFaces
A unique set of faces associated to side sets of the coarsest mesh.
std::unordered_map<int, std::unordered_set<std::size_t>> m_coarseBndNodes
A unique set of nodes associated to side sets of the coarsest mesh.
std::unordered_map<std::size_t, TetSet> m_coarseBlkElems
Set of elements associated to mesh block ids of the coarsest mesh.
std::vector<std::size_t> m_rid
Local -> refiner lib node id map.
std::unordered_map<std::size_t, std::size_t> m_lref
Local -> refiner lib node id map for previous mesh.
CkCallback m_writeCallback
Refiner lib -> local node id map for previous mesh.
std::vector<std::size_t> m_outref_ginpoel
Tetrahedron element connectivity of our chunk of the mesh (global ids) for the field-output-refined mesh.
tk::UnsMesh::Chunk m_outref_el
Elements of the mesh chunk we operate on for the field-output-refined mesh.
tk::UnsMesh::Coords m_outref_coord
Coordinates of mesh nodes of our chunk of the mesh for field-output-refined mesh.
std::unordered_map<std::size_t, Edge> m_outref_addedNodes
Newly added mesh nodes (local id) and their parents (local ids) for the field-output-refined mesh.
std::unordered_map<std::size_t, std::size_t> m_outref_addedTets
Newly added mesh cells (local id) and their parent (local id) for the field-output-refined mesh.
tk::NodeCommMap m_outref_nodeCommMap
Global mesh node IDs bordering the mesh chunk held by fellow worker chares associated to their chare IDs for the coarse mesh for the field-output-refined mesh.
std::map<int, std::vector<std::size_t>> m_outref_bface
List of boundary faces associated to side-set IDs for the field-output-refined mesh.
std::map<int, std::vector<std::size_t>> m_outref_bnode
List of boundary nodes associated to side-set IDs for the field-output-refined mesh.
std::vector<std::size_t> m_outref_triinpoel
Boundary face-node connectivity for the field-output-refinedmesh.
void pup(PUP::er& p) override
Pack/Unpack serialize member function.
void operator|(PUP::er& p, Refiner& r)
Pack/Unpack serialize operator|.

Enum documentation

enum class inciter::Refiner::RefMode: std::size_t

Mode of operation: the way Refiner is used.

Enumerators
T0REF

Initial (t<0) refinement.

DTREF

During time stepping (t>0)

OUTREF

Refinement for field output.

OUTDEREF

Function documentation

inciter::Refiner::Refiner(std::size_t meshid, const CProxy_Transporter& transporter, const CProxy_Sorter& sorter, const tk::CProxy_MeshWriter& meshwriter, const std::vector<Scheme>& scheme, const tk::RefinerCallback& cbr, const tk::SorterCallback& cbs, const std::vector<std::size_t>& ginpoel, const tk::UnsMesh::CoordMap& coordmap, const std::map<int, std::vector<std::size_t>>& bface, const std::vector<std::size_t>& triinpoel, const std::map<int, std::vector<std::size_t>>& bnode, const std::vector<std::size_t>& elemblid, int nchare) explicit

Constructor.

Parameters
meshid in Mesh ID
transporter in Transporter (host) proxy
sorter in Mesh reordering (sorter) proxy
meshwriter in Mesh writer proxy
scheme in Discretization schemes (one per mesh)
cbr in Charm++ callbacks for Refiner
cbs in Charm++ callbacks for Sorter
ginpoel in Mesh connectivity (this chare) using global node IDs
coordmap in Mesh node coordinates (this chare) for global node IDs
bface in File-internal elem ids of side sets
triinpoel in Triangle face connectivity with global IDs
bnode in Node lists of side sets
elemblid in Mesh block ids associated to local tet ids
nchare in Total number of refiner chares (chare array elements)

void inciter::Refiner::query(int fromch, const EdgeSet& edges)

Incoming query for a list boundary edges for which this chare compiles shared edges.

Parameters
fromch in Sender chare ID
edges in Chare-boundary edge list from another chare

void inciter::Refiner::bnd(int fromch, const std::vector<int>& chares)

Receive shared boundary edges for our mesh chunk.

Parameters
fromch in Sender chare ID
chares in Chare ids we share edges with

void inciter::Refiner::dtref(const std::map<int, std::vector<std::size_t>>& bface, const std::map<int, std::vector<std::size_t>>& bnode, const std::vector<std::size_t>& triinpoel)

Start mesh refinement (during time stepping, t>0)

Parameters
bface in Boundary-faces mapped to side set ids
bnode in Boundary-node lists mapped to side set ids
triinpoel in Boundary-face connectivity

void inciter::Refiner::outref(const std::map<int, std::vector<std::size_t>>& bface, const std::map<int, std::vector<std::size_t>>& bnode, const std::vector<std::size_t>& triinpoel, CkCallback c, RefMode mode = RefMode::OUTREF)

Start mesh refinement (for field output)

Parameters
bface in Boundary-faces mapped to side set ids
bnode in Boundary-node lists mapped to side set ids
triinpoel in Boundary-face connectivity
in Function to continue with after the writing field output
mode in Refinement mode

void inciter::Refiner::refine()

Do a single step of mesh refinemen/derefinementt (only tag edges)

During initial (t<0, t0ref) mesh refinement, this is a single step in a potentially multiple-entry list of initial adaptive mesh refinement steps. Distribution of the chare-boundary edges must have preceded this step, so that boundary edges (shared by multiple chares) can agree on a refinement that yields a conforming mesh across chare boundaries.

During-timestepping (t>0, dtref) mesh refinement this is called once, as we only do a single step during time stepping.

During field-output (outref) mesh refinement, this may be called multiple times, depending the number of refinement levels needed for the field output.

void inciter::Refiner::addRefBndEdges(int fromch, const AMR::EdgeData& ed, const std::unordered_set<size_t>& intermediates)

Receive newly added mesh edges and locks on our chare boundary.

Parameters
fromch in Chare call coming from
ed in Edges on chare boundary
intermediates in Intermediate nodes

Receive edges on our chare boundary from other chares Other than update remoteEdge data, this function also updates locking information for such edges whos nodes are marked as intermediate by neighboring chares.

void inciter::Refiner::correctref()

Correct refinement to arrive at conforming mesh across chare boundaries.

This function is called repeatedly until there is not a a single edge that needs correction for the whole distributed problem to arrive at a conforming mesh across chare boundaries during a mesh refinement step.

void inciter::Refiner::perform()

Perform mesh refinement and decide how to continue.

First the mesh refiner object is called to perform a single step of mesh refinement. Then, if this function is called during a step (potentially multiple levels of) initial AMR, it evaluates whether to do another one. If it is called during time stepping, this concludes the single mesh refinement step and the new mesh is sent to the PDE worker (Discretization).

void inciter::Refiner::sendProxy()

Send Refiner proxy to Discretization objects.

This should be called when bound Discretization chare array elements have already been created.

std::tuple<std::vector<std::string>, std::vector<std::vector<tk::real>>, std::vector<std::string>, std::vector<std::vector<tk::real>>> inciter::Refiner::refinementFields() const

Get refinement field data in mesh cells.

Returns Names and fields of mesh refinement data in mesh cells and nodes

void inciter::Refiner::pup(PUP::er& p) override

Pack/Unpack serialize member function.

Parameters
in/out Charm++'s PUP::er serializer object reference

void inciter::Refiner::operator|(PUP::er& p, Refiner& r)

Pack/Unpack serialize operator|.

Parameters
in/out Charm++'s PUP::er serializer object reference
in/out Refiner object reference

Variable documentation

tk::UnsMesh::Chunk inciter::Refiner::m_el

Elements of the mesh chunk we operate on

The first vector is the element connectivity (local IDs), the second vector is the global node IDs of owned elements, while the third one is a map of global->local node IDs.

std::unordered_map<std::size_t, std::size_t> inciter::Refiner::m_lref

Local -> refiner lib node id map for previous mesh.

Refiner lib -> local node id map

CkCallback inciter::Refiner::m_writeCallback

Refiner lib -> local node id map for previous mesh.

Child -> parent tet map for previous mesh Function to continue with after writing field output

tk::UnsMesh::Chunk inciter::Refiner::m_outref_el

Elements of the mesh chunk we operate on for the field-output-refined mesh.

The first vector is the element connectivity (local IDs), the second vector is the global node IDs of owned elements, while the third one is a map of global->local node IDs.