Public Types | Public Member Functions | Private Member Functions | Private Attributes

LCM::Subgraph Class Reference

#include <Subgraph.h>

Collaboration diagram for LCM::Subgraph:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::map< Vertex, size_t > ComponentMap
 Function determines whether the input vertex is an articulation point of the subgraph.

Public Member Functions

 Subgraph (RCP< Albany::AbstractSTKMeshStruct > stk_mesh_struct, std::set< EntityKey >::iterator first_vertex, std::set< EntityKey >::iterator last_vertex, std::set< stkEdge >::iterator first_edge, std::set< stkEdge >::iterator last_edge)
 Create a subgraph given two vectors: a vertex list and a edge list.
EntityKey localToGlobal (Vertex local_vertex)
 Map a vertex in the subgraph to a entity in the stk mesh.
Vertex globalToLocal (EntityKey global_vertex_key)
 Map a entity in the stk mesh to a vertex in the subgraph.
Vertex addVertex (EntityRank vertex_rank)
 Add a vertex in the subgraph.
Vertex cloneVertex (Vertex &old_vertex)
void removeVertex (Vertex const vertex)
 Remove vertex in subgraph.
std::pair< Edge, bool > addEdge (EdgeId const edge_id, Vertex const local_source_vertex, Vertex const local_target_vertex)
 Add edge to local graph.
void removeEdge (Vertex const &local_source_vertex, Vertex const &local_target_vertex)
 Remove edge from graph.
EntityRank getVertexRank (Vertex const vertex)
EdgeId getEdgeId (Edge const edge)
void testArticulationPoint (Vertex const input_vertex, size_t &number_components, ComponentMap &component_map)
void cloneBoundaryEntity (Vertex &vertex, Vertex &newVertex, std::map< EntityKey, bool > &entity_open)
 Clones a boundary entity from the subgraph and separates the in-edges of the entity.
Vertex cloneBoundaryEntity (Vertex vertex)
std::map< Entity *, Entity * > splitArticulationPoint (Vertex vertex, std::map< EntityKey, bool > &entity_open)
 Splits an articulation point.
std::map< Entity *, Entity * > splitArticulationPoint (Vertex vertex)
void cloneOutEdges (Vertex old_vertex, Vertex new_vertex)
 Clone all out edges of a vertex to a new vertex.
void outputToGraphviz (std::string &gviz_output, std::map< EntityKey, bool > entity_open)
 Output the graph associated with the mesh to graphviz .dot file for visualization purposes.
size_t const getSpaceDimension ()
 Accessors and mutators.
RCP
< Albany::AbstractSTKMeshStruct > & 
getSTKMeshStruct ()
BulkData * getBulkData ()
stk::mesh::fem::FEMMetaData * getMetaData ()
EntityRank const getCellRank ()
EntityRank const getBoundaryRank ()
IntScalarFieldTypegetFractureState ()
void setFractureState (Entity const &e, FractureState const fs)
FractureState getFractureState (Entity const &e)
bool isInternal (Entity const &e)
bool isOpen (Entity const &e)
bool isInternalAndOpen (Entity const &e)

Private Member Functions

 Subgraph (const Subgraph &)
 Private to prohibit copying.
Subgraphoperator= (const Subgraph &)
 Private to prohibit copying.
void communicate_and_create_shared_entities (Entity &node, EntityKey new_node_key)
void bcast_key (unsigned root, EntityKey &node_key)

Private Attributes

RCP
< Albany::AbstractSTKMeshStruct
stk_mesh_struct_
 stk mesh data
std::map< Vertex, EntityKey > local_global_vertex_map_
 map local vertex -> global entity key
std::map< EntityKey, Vertexglobal_local_vertex_map_
 map global entity key -> local vertex

Detailed Description

Definition at line 16 of file Subgraph.h.


Member Typedef Documentation

typedef std::map<Vertex, size_t> LCM::Subgraph::ComponentMap

Function determines whether the input vertex is an articulation point of the subgraph.

Parameters:
[in] Input vertex
[out] Number of components
[out] map of vertex and associated component number

Function checks vertex by the boost connected components algorithm to a copy of the subgraph. The copy does not include the input vertex. Copy is an undirected graph as required by the connected components algorithm.

Returns the number of connected components as well as a map of the vertex in the subgraph and the component number.

Definition at line 164 of file Subgraph.h.


Constructor & Destructor Documentation

LCM::Subgraph::Subgraph ( RCP< Albany::AbstractSTKMeshStruct stk_mesh_struct,
std::set< EntityKey >::iterator  first_vertex,
std::set< EntityKey >::iterator  last_vertex,
std::set< stkEdge >::iterator  first_edge,
std::set< stkEdge >::iterator  last_edge 
)

Create a subgraph given two vectors: a vertex list and a edge list.

Parameters:
[in] bulkData for the stk mesh object
[in] start of the vertex list
[in] end of the vertex list
[in] start of the edge list
[in] end of the edge list
[in] number of dimensions in the analysis

Subgraph stored as a boost adjacency list. Maps are created to associate the subgraph to the global stk mesh graph. Any changes to the subgraph are automatically mirrored in the stk mesh.

Definition at line 13 of file Subgraph.cc.

LCM::Subgraph::Subgraph ( const Subgraph  )  [private]

Private to prohibit copying.


Member Function Documentation

EntityKey LCM::Subgraph::localToGlobal ( Vertex  local_vertex  ) 

Map a vertex in the subgraph to a entity in the stk mesh.

Parameters:
[in] Vertex in the subgraph
Returns:
Global entity key for the stk mesh

Return the global entity key (in the stk mesh) given a local subgraph vertex (in the boost subgraph).

Definition at line 107 of file Subgraph.cc.

Vertex LCM::Subgraph::globalToLocal ( EntityKey  global_vertex_key  ) 

Map a entity in the stk mesh to a vertex in the subgraph.

Parameters:
[in] Global entity key for the stk mesh
Returns:
Vertex in the subgraph

Return local vertex (in the boost graph) given global entity key (in the stk mesh).

Definition at line 121 of file Subgraph.cc.

Vertex LCM::Subgraph::addVertex ( EntityRank  vertex_rank  ) 

Add a vertex in the subgraph.

Parameters:
[in] Rank of vertex to be added
Returns:
New vertex

Mirrors the change in the subgraph by adding a corresponding entity to the stk mesh. Adds the relationship between the vertex and entity to the maps localGlobalVertexMap and globalLocalVertexMap.

Definition at line 135 of file Subgraph.cc.

Vertex LCM::Subgraph::cloneVertex ( Vertex old_vertex  ) 

Definition at line 258 of file Subgraph.cc.

void LCM::Subgraph::removeVertex ( Vertex const   vertex  ) 

Remove vertex in subgraph.

Parameters:
[in] Vertex to be removed

When the vertex is removed from the subgraph the corresponding entity from the stk mesh is also removed.

Both boost and stk require that all edges to and from the vertex/entity are removed before deletion. If any edges remain, will be removed before the vertex/entity deletion.

Definition at line 344 of file Subgraph.cc.

std::pair< Edge, bool > LCM::Subgraph::addEdge ( EdgeId const   edge_id,
Vertex const   local_source_vertex,
Vertex const   local_target_vertex 
)

Add edge to local graph.

Parameters:
[in] Local ID of the target vertex with respect to the srouce vertex
[in] Source vertex in the subgraph
[in] Target vertex in the subgraph
Returns:
New edge and boolean value. If true, edge was inserted, if false not inserted

The edge insertion is mirrored in stk mesh. The edge is only inserted into the stk mesh object if it was inserted into the subgraph.

Definition at line 392 of file Subgraph.cc.

void LCM::Subgraph::removeEdge ( Vertex const &  local_source_vertex,
Vertex const &  local_target_vertex 
)

Remove edge from graph.

Parameters:
[in] Source vertex in subgraph
[in] Target vertex in subgraph

Edge removal is mirrored in the stk mesh.

Definition at line 438 of file Subgraph.cc.

EntityRank LCM::Subgraph::getVertexRank ( Vertex const   vertex  ) 
Parameters:
[in] Vertex in subgraph
Returns:
Rank of vertex

Definition at line 485 of file Subgraph.cc.

EdgeId LCM::Subgraph::getEdgeId ( Edge const   edge  ) 
Parameters:
[in] Edge in subgraph
Returns:
Local numbering of edge target with respect to edge source

In stk mesh, all relationships between entities have a local Id representing the correct ordering. Need this information to create or delete relations in the stk mesh.

Definition at line 496 of file Subgraph.cc.

void LCM::Subgraph::testArticulationPoint ( Vertex const   input_vertex,
size_t &  number_components,
ComponentMap component_map 
)

Definition at line 508 of file Subgraph.cc.

void LCM::Subgraph::cloneBoundaryEntity ( Vertex vertex,
Vertex newVertex,
std::map< EntityKey, bool > &  entity_open 
)

Clones a boundary entity from the subgraph and separates the in-edges of the entity.

Parameters:
[in] Boundary vertex
[out] New boundary vertex
Map of entity and boolean value is open

Boundary entities are on boundary of the elements in the mesh. They will thus have either 1 or 2 in-edges to elements.

If there is only 1 in-edge, the entity may be on the exterior of the mesh and is not a candidate for fracture for this subgraph. The boundary entity may be a valid candidate in another step. If only 1 in edge: Return.

Entity must have satisfied the fracture criterion and be labeled open in map is_open. If not open: Return.

Definition at line 698 of file Subgraph.cc.

Vertex LCM::Subgraph::cloneBoundaryEntity ( Vertex  vertex  ) 

Definition at line 634 of file Subgraph.cc.

std::map< Entity *, Entity * > LCM::Subgraph::splitArticulationPoint ( Vertex  vertex,
std::map< EntityKey, bool > &  entity_open 
)

Splits an articulation point.

Parameters:
[in] Input vertex
Map of entity and boolean value is open
Returns:
Map of element and new node

An articulation point is defined as a vertex which if removed yields a graph with more than 1 connected components. Creates an undirected graph and checks connected components of graph without vertex. Check if vertex is articulation point.

Clones articulation point and splits in-edges between original and new vertices. The out-edges of the vertex are not in the subgraph. For a consistent global graph, add the out-edges of the vertex to the new vertex/vertices.

If the vertex is a node, create a map between the element and the new node. If the nodal connectivity of an element does not change, do not add to the map.

Definition at line 906 of file Subgraph.cc.

std::map< Entity *, Entity * > LCM::Subgraph::splitArticulationPoint ( Vertex  vertex  ) 

Definition at line 757 of file Subgraph.cc.

void LCM::Subgraph::cloneOutEdges ( Vertex  old_vertex,
Vertex  new_vertex 
)

Clone all out edges of a vertex to a new vertex.

Parameters:
[in] Old vertex
[in] New vertex

The global graph must remain consistent when new vertices are added. In split_articulation_point and clone_boundary_entity, all out-edges of the original vertex may not be in the subgraph.

If there are missing edges in the subgraph, clone them from the original vertex to the new vertex. Edges not originally in the subgraph are added to the global graph only.

Definition at line 1015 of file Subgraph.cc.

void LCM::Subgraph::outputToGraphviz ( std::string &  gviz_output,
std::map< EntityKey, bool >  entity_open 
)

Output the graph associated with the mesh to graphviz .dot file for visualization purposes.

Parameters:
[in] output file
[in] map of entity and boolean value is open

Similar to output_to_graphviz function in Topology class. If fracture criterion for entity is satisfied, the entity and all associated lower order entities are marked open. All open entities are displayed as such in output file.

To create final output figure, run command below from terminal: dot -Tpng <gviz_output>.dot -o <gviz_output>.png

Parameters:
[in] output file
[in] map of entity and boolean value is open

Similar to outputToGraphviz function in Topology class. If fracture criterion for entity is satisfied, the entity and all associated lower order entities are marked open. All open entities are displayed as such in output file.

To create final output figure, run command below from terminal: dot -Tpng <gviz_output>.dot -o <gviz_output>.png

Definition at line 1078 of file Subgraph.cc.

size_t const LCM::Subgraph::getSpaceDimension (  )  [inline]

Accessors and mutators.

Definition at line 265 of file Subgraph.h.

RCP<Albany::AbstractSTKMeshStruct>& LCM::Subgraph::getSTKMeshStruct (  )  [inline]

Definition at line 268 of file Subgraph.h.

BulkData* LCM::Subgraph::getBulkData (  )  [inline]

Definition at line 272 of file Subgraph.h.

stk::mesh::fem::FEMMetaData* LCM::Subgraph::getMetaData (  )  [inline]

Definition at line 276 of file Subgraph.h.

EntityRank const LCM::Subgraph::getCellRank (  )  [inline]

Definition at line 280 of file Subgraph.h.

EntityRank const LCM::Subgraph::getBoundaryRank (  )  [inline]

Definition at line 283 of file Subgraph.h.

IntScalarFieldType& LCM::Subgraph::getFractureState (  )  [inline]

Definition at line 290 of file Subgraph.h.

void LCM::Subgraph::setFractureState ( Entity const &  e,
FractureState const   fs 
) [inline]

Definition at line 297 of file Subgraph.h.

FractureState LCM::Subgraph::getFractureState ( Entity const &  e  )  [inline]

Definition at line 308 of file Subgraph.h.

bool LCM::Subgraph::isInternal ( Entity const &  e  )  [inline]

Definition at line 316 of file Subgraph.h.

bool LCM::Subgraph::isOpen ( Entity const &  e  )  [inline]

Definition at line 332 of file Subgraph.h.

bool LCM::Subgraph::isInternalAndOpen ( Entity const &  e  )  [inline]

Definition at line 337 of file Subgraph.h.

Subgraph& LCM::Subgraph::operator= ( const Subgraph  )  [private]

Private to prohibit copying.

void LCM::Subgraph::communicate_and_create_shared_entities ( Entity node,
EntityKey  new_node_key 
) [private]

Definition at line 179 of file Subgraph.cc.

void LCM::Subgraph::bcast_key ( unsigned  root,
EntityKey &  node_key 
) [private]

Definition at line 234 of file Subgraph.cc.


Member Data Documentation

stk mesh data

Definition at line 352 of file Subgraph.h.

std::map<Vertex, EntityKey> LCM::Subgraph::local_global_vertex_map_ [private]

map local vertex -> global entity key

Definition at line 357 of file Subgraph.h.

std::map<EntityKey, Vertex> LCM::Subgraph::global_local_vertex_map_ [private]

map global entity key -> local vertex

Definition at line 362 of file Subgraph.h.


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