NetworkMesh

class NetworkMesh : public godzilla::Mesh

Public Functions

std::tuple<Int, Int> num_sub_networks() const

Gets the number of subnetworks.

Returns:

local and global number of subnetworks

void set_num_sub_networks(Int n, Int N)

Sets the number of subnetworks.

Parameters:
  • n – local number of subnetworks

  • N – global number of subnetworks

Int add_sub_network(String name, std::vector<Int> &edge_list)

Add a subnetwork.

Parameters:
  • name – Name of the subnetwork

  • edge_list – list of edges for this subnetwork, this is a one dimensional array with pairs of entries being the two vertices (in global numbering of the vertices) of each edge, e0v0 e0v1 e1v0 e1v1 ...

int num_components(Int p) const

Get the number of components at a vertex/edge.

std::tuple<Int, Int> num_vertices() const

Get the local and global number of vertices for the entire network.

Range vertex_range() const

Get the bounds [start, end) for the local vertices.

std::vector<Int> supporting_edges(Int vertex)

Return the supporting edges for this vertex point.

bool is_ghost_vertex(Int p) const

Returns true if the vertex is a ghost vertex.

std::tuple<Int, Int> num_edges() const

Get the local and global number of edges for the entire network.

Range edge_range() const

Get the bounds [start, end) for the local edges.

std::array<Int, 2> connected_vertices(Int edge)

Return the connected vertices for this edge point.

void layout_set_up()

Sets up the bare layout (graph) for the network.

void distribute(Int overlap = 0)

Distributes the network and moves associated component data.

Int edge_offset(Int p) const

Get the offset for accessing the variables associated with the given edge from the local subvector.

Int global_edge_index(Int p) const

Get the global numbering for the edge on the network.

Parameters:

p – Edge point

Returns:

the global numbering for the edge

Int global_vec_offset(Int p, Int comp_num) const

Get the global offset for accessing the variables associated with a component for the given vertex/edge from the global vector.

Parameters:
  • p – The edge or vertex point

  • comp_num – component number; use ALL_COMPONENTS if no specific component is requested

Returns:

The global offset

Int global_vertex_index(Int p) const

Get the global numbering for the vertex on the network.

Parameters:

p – Vertex point

Returns:

The global numbering for the vertex

Int local_vec_offset(Int p, Int comp_num) const

Get the offset for accessing the variables associated with a component at the given vertex/edge from the local vector.

Parameters:
  • p – The edge or vertex point

  • comp_num – Component number; use ALL_COMPONENTS if no specific component is requested

Returns:

The local offset

Int vertex_offset(Int p) const

Get the offset for accessing the variables associated with the given vertex from the local subvector.

Parameters:

p – The vertex point

Returns:

The offset

void edge_set_matrix(Int p, const std::array<Matrix, 3> &J)

Sets user-provided Jacobian matrices for this edge to the network.

Parameters:
  • p – The edge point

  • J – Array of Jacobian submatrices for this edge point:

    • J[0] this edge

    • J[1] and J[2]: connected vertices

void vertex_set_matrix(Int p, const std::vector<Matrix> &J)

Sets user-provided Jacobian matrix for this vertex to the network.

Parameters:
  • p – The vertex point

  • J – array of Jacobian (size = 2*(num of supporting edges) + 1) submatrices for this vertex point:

    • J[0]: this vertex

    • J[1+2i]: i-th supporting edge

    • J[1+2i+1]: i-th connected vertex