Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #if !defined(LCM_Topology_Subgraph_h)
00008 #define LCM_Topology_Subgraph_h
00009
00010 #include <stk_mesh/base/FieldData.hpp>
00011
00012 #include "Topology_Types.h"
00013
00014 namespace LCM {
00015
00016 class Subgraph: public Graph {
00017 public:
00018
00035 Subgraph(RCP<Albany::AbstractSTKMeshStruct> stk_mesh_struct,
00036 std::set<EntityKey>::iterator first_vertex,
00037 std::set<EntityKey>::iterator last_vertex,
00038 std::set<stkEdge>::iterator first_edge,
00039 std::set<stkEdge>::iterator last_edge);
00040
00050 EntityKey
00051 localToGlobal(Vertex local_vertex);
00052
00062 Vertex
00063 globalToLocal(EntityKey global_vertex_key);
00064
00075 Vertex
00076 addVertex(EntityRank vertex_rank);
00077
00078 Vertex
00079 cloneVertex(Vertex & old_vertex);
00080
00093 void
00094 removeVertex(Vertex const vertex);
00095
00109 std::pair<Edge, bool>
00110 addEdge(
00111 EdgeId const edge_id,
00112 Vertex const local_source_vertex,
00113 Vertex const local_target_vertex);
00114
00124 void
00125 removeEdge(
00126 Vertex const & local_source_vertex,
00127 Vertex const & local_target_vertex);
00128
00134 EntityRank
00135 getVertexRank(Vertex const vertex);
00136
00145 EdgeId
00146 getEdgeId(Edge const edge);
00147
00164 typedef std::map<Vertex, size_t> ComponentMap;
00165 void
00166 testArticulationPoint(
00167 Vertex const input_vertex,
00168 size_t & number_components,
00169 ComponentMap & component_map);
00170
00190 void
00191 cloneBoundaryEntity(Vertex & vertex, Vertex & newVertex,
00192 std::map<EntityKey, bool> & entity_open);
00193
00194 Vertex
00195 cloneBoundaryEntity(Vertex vertex);
00196
00218 std::map<Entity*, Entity*>
00219 splitArticulationPoint(Vertex vertex,
00220 std::map<EntityKey, bool> & entity_open);
00221
00222 std::map<Entity*, Entity*>
00223 splitArticulationPoint(Vertex vertex);
00224
00239 void
00240 cloneOutEdges(Vertex old_vertex, Vertex new_vertex);
00241
00257 void
00258 outputToGraphviz(std::string & gviz_output,
00259 std::map<EntityKey, bool> entity_open);
00260
00264 size_t const
00265 getSpaceDimension() {return static_cast<size_t>(getSTKMeshStruct()->numDim);}
00266
00267 RCP<Albany::AbstractSTKMeshStruct> &
00268 getSTKMeshStruct()
00269 {return stk_mesh_struct_;}
00270
00271 BulkData *
00272 getBulkData()
00273 {return stk_mesh_struct_->bulkData;}
00274
00275 stk::mesh::fem::FEMMetaData *
00276 getMetaData()
00277 {return stk_mesh_struct_->metaData;}
00278
00279 EntityRank const
00280 getCellRank() {return getMetaData()->element_rank();}
00281
00282 EntityRank const
00283 getBoundaryRank()
00284 {
00285 assert(getCellRank() > 0);
00286 return getCellRank() - 1;
00287 }
00288
00289 IntScalarFieldType &
00290 getFractureState()
00291 {return *(stk_mesh_struct_->getFieldContainer()->getFractureState());}
00292
00293
00294
00295
00296 void
00297 setFractureState(Entity const & e, FractureState const fs)
00298 {
00299 if (e.entity_rank() < getCellRank()) {
00300 *(stk::mesh::field_data(getFractureState(), e)) = static_cast<int>(fs);
00301 }
00302 }
00303
00304
00305
00306
00307 FractureState
00308 getFractureState(Entity const & e)
00309 {
00310 return e.entity_rank() >= getCellRank() ?
00311 CLOSED :
00312 static_cast<FractureState>(*(stk::mesh::field_data(getFractureState(), e)));
00313 }
00314
00315 bool
00316 isInternal(Entity const & e) {
00317
00318 assert(e.entity_rank() == getBoundaryRank());
00319
00320 Vertex
00321 vertex = globalToLocal(e.key());
00322
00323 boost::graph_traits<Graph>::degree_size_type
00324 number_in_edges = boost::in_degree(vertex, *this);
00325
00326 assert(number_in_edges == 1 || number_in_edges == 2);
00327
00328 return number_in_edges == 2;
00329 }
00330
00331 bool
00332 isOpen(Entity const & e) {
00333 return getFractureState(e) == OPEN;
00334 }
00335
00336 bool
00337 isInternalAndOpen(Entity const & e) {
00338 return isInternal(e) == true && isOpen(e) == true;
00339 }
00340
00341 private:
00342
00344 Subgraph(const Subgraph&);
00345
00347 Subgraph& operator=(const Subgraph&);
00348
00352 RCP<Albany::AbstractSTKMeshStruct> stk_mesh_struct_;
00353
00357 std::map<Vertex, EntityKey> local_global_vertex_map_;
00358
00362 std::map<EntityKey, Vertex> global_local_vertex_map_;
00363
00364 void
00365 communicate_and_create_shared_entities(Entity & node,
00366 EntityKey new_node_key);
00367
00368 void
00369 bcast_key(unsigned root, EntityKey& node_key);
00370
00371
00372 };
00373
00374
00375 }
00376
00377 #endif // LCM_Topology_Subgraph_h