Class designed to hold node ID information and information about nodal connectivity. More...
#include <PorousFlowConnectedNodes.h>
Public Member Functions | |
PorousFlowConnectedNodes () | |
void | clear () |
clear all data in readiness for adding global nodes and connections More... | |
void | addGlobalNode (dof_id_type global_node_ID) |
Add the given global_node_ID to the internal data structures If the global node ID has already been added this method does nothing. More... | |
void | finalizeAddingGlobalNodes () |
Signal that all global node IDs have been added to the internal data structures. More... | |
std::size_t | numNodes () const |
number of nodes known by this class More... | |
dof_id_type | globalID (dof_id_type sequential_node_ID) const |
Return the global node ID (node number in the mesh) corresponding to the provided sequential node ID. More... | |
dof_id_type | sequentialID (dof_id_type global_node_ID) const |
Return the sequential node ID corresponding to the global node ID This is guaranteed to lie in the range [0, numNodes() - 1]. More... | |
const std::vector< dof_id_type > & | globalIDs () const |
Vector of all global node IDs (node numbers in the mesh) More... | |
void | addConnection (dof_id_type global_node_from, dof_id_type global_node_to) |
Specifies that global_node_to is connected to global_node_from. More... | |
void | finalizeAddingConnections () |
Signal that all global node IDs have been added to the internal data structures. More... | |
const std::vector< dof_id_type > & | sequentialConnectionsToGlobalID (dof_id_type global_node_ID) const |
Return all the nodes (sequential node IDs) connected to the given global node ID All elements of the returned vector are guaranteed to be unique and lie in the range [0, numNodes() - 1]. More... | |
const std::vector< dof_id_type > & | sequentialConnectionsToSequentialID (dof_id_type sequential_node_ID) const |
Return all the nodes (sequential node IDs) connected to the given sequential node ID All elements of the returned vector are guaranteed to be unique and lie in the range [0, numNodes() - 1]. More... | |
const std::vector< dof_id_type > & | globalConnectionsToGlobalID (dof_id_type global_node_ID) const |
Return all the nodes (global node IDs) connected to the given global node ID. More... | |
const std::vector< dof_id_type > & | globalConnectionsToSequentialID (dof_id_type sequential_node_ID) const |
Return all the nodes (global node IDs) connected to the given sequential node ID. More... | |
unsigned | indexOfGlobalConnection (dof_id_type global_node_ID_from, dof_id_type global_node_ID_to) const |
Return the index of global_node_ID_to in the globalConnectionsToGlobalID(global_node_ID_from) vector. More... | |
unsigned | indexOfSequentialConnection (dof_id_type sequential_node_ID_from, dof_id_type sequential_node_ID_to) const |
Return the index of sequential_node_ID_to in the sequentialConnectionsToSequentialID(sequential_node_ID_from) vector. More... | |
std::size_t | sizeSequential () const |
Return the size of _sequential_id, for checking memory efficiency. More... | |
Private Attributes | |
bool | _still_adding_global_nodes |
dof_id_type | _min_global_id |
dof_id_type | _max_global_id |
std::set< dof_id_type > | _set_of_global_ids |
std::vector< dof_id_type > | _global_id |
std::vector< dof_id_type > | _sequential_id |
bool | _still_adding_connections |
std::vector< std::set< dof_id_type > > | _neighbor_sets |
std::vector< std::vector< dof_id_type > > | _sequential_neighbors |
std::vector< std::vector< dof_id_type > > | _global_neighbors |
Class designed to hold node ID information and information about nodal connectivity.
Node ID is either:
The use case of interest in PorousFlow is where many quantities are recorded at each node in the mesh. To record this, a std::vector<quantity> may be used. But if the global node IDs are sparsely distributed between zero and the maximum node number, then basing the std::vector on global ID is inefficient because there are many elements in the std::vector that are unused. Instead, a std::vector based on the sequential node ID may be used, which is optimally memory efficient. (A std::map<dof_id_type, quantity> may be used, but it is slow.)
Nodal connectivity is defined between two global node IDs. Note that it is uni-directional, meaning that if node 12 is connected to node 321, then node 321 is not necessarily connected to node 12 (the user must explicitly add both the 12->321 and 321->12 connections if that is desired).
This class is designed to be used as follows: (1) instantiation (2) populate the nodal information using addGlobalNode (3) finalizeAddingGlobalNodes() (4) populate the connectivity using addConnection (5) finalizeAddingConnections() (6) functions like sequentialID and sequentialNeighborsOfGlobalID are now ready for use
Definition at line 45 of file PorousFlowConnectedNodes.h.
PorousFlowConnectedNodes::PorousFlowConnectedNodes | ( | ) |
Definition at line 14 of file PorousFlowConnectedNodes.C.
void PorousFlowConnectedNodes::addConnection | ( | dof_id_type | global_node_from, |
dof_id_type | global_node_to | ||
) |
Specifies that global_node_to is connected to global_node_from.
Hence, globalConnectionsToGlobalID(global_node_from) will contain global_node_to. If the connection has already been added this method does nothing Recall that connections are uni-directional, so if you desire bi-directional connectivity you must call addConnection twice (the second time with arguments swapped)
global_node_from | global node ID of the 'from' node |
global_node_to | global node ID of the 'to' node |
Definition at line 96 of file PorousFlowConnectedNodes.C.
Referenced by PorousFlowConnectedNodesTest::SetUp(), and AdvectiveFluxCalculatorBase::timestepSetup().
void PorousFlowConnectedNodes::addGlobalNode | ( | dof_id_type | global_node_ID | ) |
Add the given global_node_ID to the internal data structures If the global node ID has already been added this method does nothing.
global_node_ID | node number in the mesh |
Definition at line 39 of file PorousFlowConnectedNodes.C.
Referenced by PorousFlowConnectedNodesTest::SetUp(), and AdvectiveFluxCalculatorBase::timestepSetup().
void PorousFlowConnectedNodes::clear | ( | ) |
clear all data in readiness for adding global nodes and connections
Definition at line 17 of file PorousFlowConnectedNodes.C.
Referenced by PorousFlowConnectedNodes(), and AdvectiveFluxCalculatorBase::timestepSetup().
void PorousFlowConnectedNodes::finalizeAddingConnections | ( | ) |
Signal that all global node IDs have been added to the internal data structures.
Definition at line 108 of file PorousFlowConnectedNodes.C.
Referenced by PorousFlowConnectedNodesTest::SetUp(), and AdvectiveFluxCalculatorBase::timestepSetup().
void PorousFlowConnectedNodes::finalizeAddingGlobalNodes | ( | ) |
Signal that all global node IDs have been added to the internal data structures.
Definition at line 50 of file PorousFlowConnectedNodes.C.
Referenced by PorousFlowConnectedNodesTest::SetUp(), and AdvectiveFluxCalculatorBase::timestepSetup().
const std::vector< dof_id_type > & PorousFlowConnectedNodes::globalConnectionsToGlobalID | ( | dof_id_type | global_node_ID | ) | const |
Return all the nodes (global node IDs) connected to the given global node ID.
Definition at line 143 of file PorousFlowConnectedNodes.C.
Referenced by PorousFlowAdvectiveFluxCalculatorBase::buildCommLists(), AdvectiveFluxCalculatorBase::finalize(), PorousFlowAdvectiveFluxCalculatorBase::finalize(), and AdvectiveFluxCalculatorBase::zeroedConnection().
const std::vector< dof_id_type > & PorousFlowConnectedNodes::globalConnectionsToSequentialID | ( | dof_id_type | sequential_node_ID | ) | const |
Return all the nodes (global node IDs) connected to the given sequential node ID.
Definition at line 153 of file PorousFlowConnectedNodes.C.
Referenced by AdvectiveFluxCalculatorBase::finalize(), PorousFlowAdvectiveFluxCalculatorBase::initialize(), PorousFlowAdvectiveFluxCalculatorBase::threadJoin(), and PorousFlowAdvectiveFluxCalculatorBase::timestepSetup().
dof_id_type PorousFlowConnectedNodes::globalID | ( | dof_id_type | sequential_node_ID | ) | const |
Return the global node ID (node number in the mesh) corresponding to the provided sequential node ID.
sequential_node_ID | the sequential node ID |
Definition at line 78 of file PorousFlowConnectedNodes.C.
Referenced by AdvectiveFluxCalculatorBase::finalize(), and AdvectiveFluxCalculatorBase::timestepSetup().
const std::vector< dof_id_type > & PorousFlowConnectedNodes::globalIDs | ( | ) | const |
Vector of all global node IDs (node numbers in the mesh)
Definition at line 163 of file PorousFlowConnectedNodes.C.
Referenced by PorousFlowAdvectiveFluxCalculatorBase::finalize().
unsigned PorousFlowConnectedNodes::indexOfGlobalConnection | ( | dof_id_type | global_node_ID_from, |
dof_id_type | global_node_ID_to | ||
) | const |
Return the index of global_node_ID_to in the globalConnectionsToGlobalID(global_node_ID_from) vector.
Definition at line 172 of file PorousFlowConnectedNodes.C.
Referenced by PorousFlowAdvectiveFluxCalculatorBase::buildCommLists(), AdvectiveFluxCalculatorBase::buildCommLists(), PorousFlowAdvectiveFluxCalculatorBase::executeOnElement(), AdvectiveFluxCalculatorBase::executeOnElement(), and PorousFlowAdvectiveFluxCalculatorBase::getdK_dvar().
unsigned PorousFlowConnectedNodes::indexOfSequentialConnection | ( | dof_id_type | sequential_node_ID_from, |
dof_id_type | sequential_node_ID_to | ||
) | const |
Return the index of sequential_node_ID_to in the sequentialConnectionsToSequentialID(sequential_node_ID_from) vector.
Definition at line 189 of file PorousFlowConnectedNodes.C.
Referenced by AdvectiveFluxCalculatorBase::finalize(), and AdvectiveFluxCalculatorBase::PQPlusMinus().
std::size_t PorousFlowConnectedNodes::numNodes | ( | ) | const |
number of nodes known by this class
Definition at line 31 of file PorousFlowConnectedNodes.C.
Referenced by PorousFlowAdvectiveFluxCalculatorBase::initialize(), PorousFlowAdvectiveFluxCalculatorBase::threadJoin(), AdvectiveFluxCalculatorBase::timestepSetup(), and PorousFlowAdvectiveFluxCalculatorBase::timestepSetup().
const std::vector< dof_id_type > & PorousFlowConnectedNodes::sequentialConnectionsToGlobalID | ( | dof_id_type | global_node_ID | ) | const |
Return all the nodes (sequential node IDs) connected to the given global node ID All elements of the returned vector are guaranteed to be unique and lie in the range [0, numNodes() - 1].
Definition at line 123 of file PorousFlowConnectedNodes.C.
const std::vector< dof_id_type > & PorousFlowConnectedNodes::sequentialConnectionsToSequentialID | ( | dof_id_type | sequential_node_ID | ) | const |
Return all the nodes (sequential node IDs) connected to the given sequential node ID All elements of the returned vector are guaranteed to be unique and lie in the range [0, numNodes() - 1].
Definition at line 133 of file PorousFlowConnectedNodes.C.
Referenced by AdvectiveFluxCalculatorBase::finalize(), AdvectiveFluxCalculatorBase::initialize(), AdvectiveFluxCalculatorBase::PQPlusMinus(), AdvectiveFluxCalculatorBase::rMinus(), AdvectiveFluxCalculatorBase::rPlus(), AdvectiveFluxCalculatorBase::threadJoin(), and AdvectiveFluxCalculatorBase::timestepSetup().
dof_id_type PorousFlowConnectedNodes::sequentialID | ( | dof_id_type | global_node_ID | ) | const |
Return the sequential node ID corresponding to the global node ID This is guaranteed to lie in the range [0, numNodes() - 1].
global_node_ID | global node ID (ie the node number in the mesh) |
Definition at line 87 of file PorousFlowConnectedNodes.C.
Referenced by addConnection(), PorousFlowAdvectiveFluxCalculatorBase::buildCommLists(), AdvectiveFluxCalculatorBase::buildCommLists(), PorousFlowAdvectiveFluxCalculatorBase::execute(), AdvectiveFluxCalculatorBase::execute(), PorousFlowAdvectiveFluxCalculatorBase::executeOnElement(), AdvectiveFluxCalculatorBase::executeOnElement(), PorousFlowAdvectiveFluxCalculatorBase::finalize(), finalizeAddingConnections(), PorousFlowAdvectiveFluxCalculatorBase::getdFluxOut_dvars(), AdvectiveFluxCalculatorBase::getdFluxOutdKjk(), AdvectiveFluxCalculatorBase::getdFluxOutdu(), PorousFlowAdvectiveFluxCalculatorBase::getdK_dvar(), AdvectiveFluxCalculatorBase::getFluxOut(), AdvectiveFluxCalculatorBase::getValence(), globalConnectionsToGlobalID(), indexOfGlobalConnection(), sequentialConnectionsToGlobalID(), and AdvectiveFluxCalculatorBase::timestepSetup().
std::size_t PorousFlowConnectedNodes::sizeSequential | ( | ) | const |
Return the size of _sequential_id, for checking memory efficiency.
The memory wasted by this class is (sizeSequential() - numNodes()) * (size of dof_id_type). finalizeAddingGlobalNodes() must have been called prior to calling this method
Definition at line 69 of file PorousFlowConnectedNodes.C.
Referenced by AdvectiveFluxCalculatorBase::timestepSetup().
|
private |
Definition at line 140 of file PorousFlowConnectedNodes.h.
Referenced by clear(), finalizeAddingConnections(), finalizeAddingGlobalNodes(), globalID(), globalIDs(), and numNodes().
|
private |
Definition at line 146 of file PorousFlowConnectedNodes.h.
Referenced by finalizeAddingConnections(), globalConnectionsToGlobalID(), globalConnectionsToSequentialID(), and indexOfGlobalConnection().
|
private |
Definition at line 138 of file PorousFlowConnectedNodes.h.
Referenced by addGlobalNode(), clear(), and finalizeAddingGlobalNodes().
|
private |
Definition at line 137 of file PorousFlowConnectedNodes.h.
Referenced by addGlobalNode(), clear(), finalizeAddingGlobalNodes(), and sequentialID().
|
private |
Definition at line 144 of file PorousFlowConnectedNodes.h.
Referenced by addConnection(), clear(), finalizeAddingConnections(), and finalizeAddingGlobalNodes().
|
private |
Definition at line 141 of file PorousFlowConnectedNodes.h.
Referenced by clear(), finalizeAddingGlobalNodes(), sequentialID(), and sizeSequential().
|
private |
Definition at line 145 of file PorousFlowConnectedNodes.h.
Referenced by clear(), finalizeAddingConnections(), indexOfSequentialConnection(), sequentialConnectionsToGlobalID(), and sequentialConnectionsToSequentialID().
|
private |
Definition at line 139 of file PorousFlowConnectedNodes.h.
Referenced by addGlobalNode(), clear(), finalizeAddingGlobalNodes(), and numNodes().
|
private |
Definition at line 143 of file PorousFlowConnectedNodes.h.
Referenced by addConnection(), clear(), finalizeAddingConnections(), globalConnectionsToGlobalID(), globalConnectionsToSequentialID(), indexOfGlobalConnection(), indexOfSequentialConnection(), sequentialConnectionsToGlobalID(), and sequentialConnectionsToSequentialID().
|
private |
Definition at line 136 of file PorousFlowConnectedNodes.h.
Referenced by addConnection(), addGlobalNode(), clear(), finalizeAddingGlobalNodes(), globalID(), globalIDs(), numNodes(), sequentialID(), and sizeSequential().