FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
FEAT::Adjacency::DynamicGraph Class Reference

Dynamic Adjacency Graph implementation. More...

#include <dynamic_graph.hpp>

Public Types

typedef IdxSet::const_iterator ImageIterator
 ImageIterator for Adjactor interface implementation. More...
 

Public Member Functions

 DynamicGraph ()
 default constructor More...
 
 DynamicGraph (DynamicGraph &&other)
 move ctor More...
 
 DynamicGraph (Index num_nodes_domain, Index num_nodes_image)
 Constructor. More...
 
template<typename Adjactor1_ , typename Adjactor2_ >
 DynamicGraph (RenderType render_type, const Adjactor1_ &adjactor1, const Adjactor2_ &adjactor2)
 Composite-Render constructor. More...
 
template<typename Adjactor_ >
 DynamicGraph (RenderType render_type, const Adjactor_ &adjactor)
 Render constructor. More...
 
virtual ~DynamicGraph ()
 virtual destructor More...
 
void clear ()
 Clears the graph. More...
 
DynamicGraph clone () const
 Clones this dynamic graph. More...
 
template<typename Adjactor_ >
void compose (const Adjactor_ &adjactor)
 Composes this dynamic graph with another adjactor in-situ. More...
 
Index degree () const
 Returns the degree of the graph. More...
 
Index degree (Index domain_node) const
 Returns the degree of a domain node. More...
 
bool erase (Index domain_node, Index image_node)
 Erases an adjacency entry from the graph. More...
 
bool exists (Index domain_node, Index image_node) const
 Checks whether an adjacency entry exists. More...
 
Index get_num_indices () const
 Returns the total number of indices. More...
 
Index get_num_nodes_domain () const
 Returns the number of domain nodes. More...
 
Index get_num_nodes_image () const
 Returns the number of image nodes. More...
 
ImageIterator image_begin (Index domain_node) const
 Returns an iterator for the first adjacent image node. More...
 
ImageIterator image_end (Index domain_node) const
 Returns an iterator for the first position past the last adjacent image node. More...
 
bool insert (Index domain_node, Index image_node)
 Inserts a new adjacency entry to the graph. More...
 
DynamicGraphoperator= (DynamicGraph &&other)
 move-assign operator More...
 

Protected Attributes

IdxSetVec _indices
 index-set-vector More...
 
Index _num_nodes_domain
 total number of domain nodes More...
 
Index _num_nodes_image
 total number of image nodes More...
 

Detailed Description

Dynamic Adjacency Graph implementation.

This class implements a dynamic counterpart of the Graph class.

Author
Peter Zajac

Definition at line 28 of file dynamic_graph.hpp.

Member Typedef Documentation

◆ ImageIterator

typedef IdxSet::const_iterator FEAT::Adjacency::DynamicGraph::ImageIterator

ImageIterator for Adjactor interface implementation.

Definition at line 38 of file dynamic_graph.hpp.

Constructor & Destructor Documentation

◆ DynamicGraph() [1/5]

FEAT::Adjacency::DynamicGraph::DynamicGraph ( )
inline

default constructor

Definition at line 50 of file dynamic_graph.hpp.

◆ DynamicGraph() [2/5]

FEAT::Adjacency::DynamicGraph::DynamicGraph ( Index  num_nodes_domain,
Index  num_nodes_image 
)
inlineexplicit

Constructor.

This constructor creates an empty dynamic adjacency graph.

Parameters
[in]num_nodes_domainThe total number of domain nodes for the graph.
[in]num_nodes_imageThe total number of image nodes for the graph.

Definition at line 67 of file dynamic_graph.hpp.

◆ DynamicGraph() [3/5]

template<typename Adjactor_ >
FEAT::Adjacency::DynamicGraph::DynamicGraph ( RenderType  render_type,
const Adjactor_ &  adjactor 
)
inlineexplicit

Render constructor.

This constructor renders an object implementing the Adjactor interface into a graph.

Parameters
[in]render_typeThe render type. See RenderType for details.
[in]adjactorA reference to the adjactor that is to be rendered.

Definition at line 89 of file dynamic_graph.hpp.

References FEAT::Adjacency::as_is, FEAT::Adjacency::as_is_sorted, FEAT::Adjacency::injectify, FEAT::Adjacency::injectify_sorted, FEAT::Adjacency::injectify_transpose, FEAT::Adjacency::injectify_transpose_sorted, FEAT::Adjacency::transpose, and FEAT::Adjacency::transpose_sorted.

◆ DynamicGraph() [4/5]

template<typename Adjactor1_ , typename Adjactor2_ >
FEAT::Adjacency::DynamicGraph::DynamicGraph ( RenderType  render_type,
const Adjactor1_ &  adjactor1,
const Adjactor2_ &  adjactor2 
)
inlineexplicit

Composite-Render constructor.

This constructor renders a composition of two objects implementing the Adjactor interface into a graph.

Parameters
[in]render_typeThe render type. See RenderType for details.
[in]adjactor1A reference to the first adjactor in the composition that is to be rendered.
[in]adjactor2A reference to the second adjactor in the composition that is to be rendered.

Definition at line 132 of file dynamic_graph.hpp.

References FEAT::Adjacency::as_is, FEAT::Adjacency::as_is_sorted, FEAT::Adjacency::injectify, FEAT::Adjacency::injectify_sorted, FEAT::Adjacency::injectify_transpose, FEAT::Adjacency::injectify_transpose_sorted, FEAT::Adjacency::transpose, and FEAT::Adjacency::transpose_sorted.

◆ DynamicGraph() [5/5]

FEAT::Adjacency::DynamicGraph::DynamicGraph ( DynamicGraph &&  other)
inline

move ctor

Definition at line 160 of file dynamic_graph.hpp.

◆ ~DynamicGraph()

virtual FEAT::Adjacency::DynamicGraph::~DynamicGraph ( )
inlinevirtual

virtual destructor

Definition at line 184 of file dynamic_graph.hpp.

Member Function Documentation

◆ clear()

void FEAT::Adjacency::DynamicGraph::clear ( )
inline

Clears the graph.

This function erases all adjacency entries in the graph.

Definition at line 262 of file dynamic_graph.hpp.

References _indices, and _num_nodes_domain.

◆ clone()

DynamicGraph FEAT::Adjacency::DynamicGraph::clone ( ) const
inline

Clones this dynamic graph.

Returns
A deep-copy of this dynamic graph.

Definition at line 193 of file dynamic_graph.hpp.

References _indices, _num_nodes_domain, and _num_nodes_image.

◆ compose()

template<typename Adjactor_ >
void FEAT::Adjacency::DynamicGraph::compose ( const Adjactor_ &  adjactor)
inline

Composes this dynamic graph with another adjactor in-situ.

Parameters
[in]adjactorAn object implementing the Adjactor interface that is to be composed.

Definition at line 335 of file dynamic_graph.hpp.

References _indices, _num_nodes_domain, _num_nodes_image, and XASSERTM.

◆ degree() [1/2]

Index FEAT::Adjacency::DynamicGraph::degree ( ) const
inline

Returns the degree of the graph.

This function returns the degree of the graph, i.e. the maximum of the degrees of all domain nodes.

Attention
This function performs a loop over all domain nodes and therefore has linear runtime. It is recommended to store the result of this function in a variable if the degree is needed multiple times.
Returns
The degree of the graph.

Definition at line 229 of file dynamic_graph.hpp.

References _indices, and _num_nodes_domain.

◆ degree() [2/2]

Index FEAT::Adjacency::DynamicGraph::degree ( Index  domain_node) const
inline

Returns the degree of a domain node.

This function returns the degree of a domain node, i.e. the number of image nodes which are adjacent to the specified domain node.

Parameters
[in]domain_nodeThe domain node index whose degree is to be returned.
Returns
The degree of the specified domain node.

Definition at line 212 of file dynamic_graph.hpp.

References _indices, _num_nodes_domain, and ASSERTM.

◆ erase()

bool FEAT::Adjacency::DynamicGraph::erase ( Index  domain_node,
Index  image_node 
)
inline

Erases an adjacency entry from the graph.

Parameters
[in]domain_nodeThe index of the domain node of the adjacency entry.
[in]image_nodeThe index of the image node of the adjacency entry.
Returns
true, if the adjacency was erased or false, if the adjacency did not exist.

Definition at line 320 of file dynamic_graph.hpp.

References _indices, _num_nodes_domain, _num_nodes_image, and ASSERTM.

◆ exists()

bool FEAT::Adjacency::DynamicGraph::exists ( Index  domain_node,
Index  image_node 
) const
inline

Checks whether an adjacency entry exists.

Parameters
[in]domain_nodeThe index of the domain node of the adjacency entry.
[in]image_nodeThe index of the image node of the adjacency entry.
Returns
true, if the adjacency exists, otherwise false.

Definition at line 282 of file dynamic_graph.hpp.

References _indices, _num_nodes_domain, _num_nodes_image, and ASSERTM.

◆ get_num_indices()

Index FEAT::Adjacency::DynamicGraph::get_num_indices ( ) const
inline

Returns the total number of indices.

Attention
This function has linear runtime in the number of domain nodes!
Returns
The total number of indices in the graph.

Definition at line 247 of file dynamic_graph.hpp.

References _indices, and _num_nodes_domain.

Referenced by FEAT::LAFEM::TestMatrixFactory::_create_generic_struct(), FEAT::LAFEM::TestMatrixFactory::_create_non_empty_diag_struct(), and FEAT::LAFEM::TestMatrixFactory::_create_symmetric_struct().

◆ get_num_nodes_domain()

Index FEAT::Adjacency::DynamicGraph::get_num_nodes_domain ( ) const
inline

Returns the number of domain nodes.

Returns
The total number of domain nodes in the adjactor.

Definition at line 508 of file dynamic_graph.hpp.

References _num_nodes_domain.

◆ get_num_nodes_image()

Index FEAT::Adjacency::DynamicGraph::get_num_nodes_image ( ) const
inline

Returns the number of image nodes.

Returns
The total number of image nodes in the adjactor.

Definition at line 514 of file dynamic_graph.hpp.

References _num_nodes_image.

◆ image_begin()

ImageIterator FEAT::Adjacency::DynamicGraph::image_begin ( Index  domain_node) const
inline

Returns an iterator for the first adjacent image node.

Parameters
[in]domain_nodeThe index of the domain node whose image node iterator is to be returned.
Returns
An iterator representing the first image node adjacent to domain_node, or image_end(domain_node) if no adjacent image nodes exist.

Definition at line 520 of file dynamic_graph.hpp.

References _indices, _num_nodes_domain, and ASSERTM.

◆ image_end()

ImageIterator FEAT::Adjacency::DynamicGraph::image_end ( Index  domain_node) const
inline

Returns an iterator for the first position past the last adjacent image node.

Parameters
[in]domain_nodeThe index of the domain node whose image node iterator is to be returned.
Returns
An iterator representing the first position past the last image node adjacent to domain_node.

Definition at line 527 of file dynamic_graph.hpp.

References _indices, _num_nodes_domain, and ASSERTM.

◆ insert()

bool FEAT::Adjacency::DynamicGraph::insert ( Index  domain_node,
Index  image_node 
)
inline

Inserts a new adjacency entry to the graph.

Parameters
[in]domain_nodeThe index of the domain node of the adjacency entry.
[in]image_nodeThe index of the image node of the adjacency entry.
Returns
true, if the adjacency was inserted or false, if the adjacency already existed.

Definition at line 301 of file dynamic_graph.hpp.

References _indices, _num_nodes_domain, _num_nodes_image, and ASSERTM.

Referenced by FEAT::Global::AlgDofPartiMatrix< LocalMatrix_, Mirror_ >::_assemble_structure(), FEAT::LAFEM::TestMatrixFactory::_create_generic_struct(), FEAT::LAFEM::TestMatrixFactory::_create_non_empty_diag_struct(), and FEAT::LAFEM::TestMatrixFactory::_create_symmetric_struct().

◆ operator=()

DynamicGraph & FEAT::Adjacency::DynamicGraph::operator= ( DynamicGraph &&  other)
inline

move-assign operator

Definition at line 168 of file dynamic_graph.hpp.

References _indices, _num_nodes_domain, and _num_nodes_image.

Member Data Documentation

◆ _indices

IdxSetVec FEAT::Adjacency::DynamicGraph::_indices
protected

index-set-vector

Definition at line 46 of file dynamic_graph.hpp.

Referenced by clear(), clone(), compose(), degree(), erase(), exists(), get_num_indices(), image_begin(), image_end(), insert(), and operator=().

◆ _num_nodes_domain

Index FEAT::Adjacency::DynamicGraph::_num_nodes_domain
protected

total number of domain nodes

Definition at line 42 of file dynamic_graph.hpp.

Referenced by clear(), clone(), compose(), degree(), erase(), exists(), get_num_indices(), get_num_nodes_domain(), image_begin(), image_end(), insert(), and operator=().

◆ _num_nodes_image

Index FEAT::Adjacency::DynamicGraph::_num_nodes_image
protected

total number of image nodes

Definition at line 44 of file dynamic_graph.hpp.

Referenced by clone(), compose(), erase(), exists(), get_num_nodes_image(), insert(), and operator=().


The documentation for this class was generated from the following file: