9 #include <stk_mesh/fixtures/RingFixture.hpp> 11 #include <stk_util/parallel/Parallel.hpp> 13 #include <stk_util/environment/ReportHandler.hpp> 15 #include <stk_mesh/base/Types.hpp> 16 #include <stk_mesh/base/MetaData.hpp> 17 #include <stk_mesh/base/BulkData.hpp> 18 #include <stk_mesh/base/MetaData.hpp> 19 #include <stk_mesh/base/Entity.hpp> 20 #include <stk_mesh/base/EntityComm.hpp> 21 #include <stk_mesh/base/GetEntities.hpp> 23 #include <Shards_BasicTopologies.hpp> 36 unsigned num_edge_per_proc ,
38 : m_spatial_dimension(1),
39 m_meta_data( m_spatial_dimension ),
40 m_bulk_data( fem::FEMMetaData::get_meta_data(m_meta_data), pm, 100 ),
42 m_edge_part_extra( m_meta_data.
declare_part(
"edge_extra" , m_meta_data.element_rank() ) ),
43 m_num_edge_per_proc( num_edge_per_proc ),
47 if ( use_edge_parts ) {
48 m_edge_parts.resize( num_edge_per_proc );
49 for (
unsigned i = 0 ; i < num_edge_per_proc ; ++i ) {
50 std::ostringstream name ;
51 name <<
"EdgePart_" << i ;
61 const unsigned nPerProc = m_num_edge_per_proc ;
62 const unsigned id_total = nPerProc * p_size ;
63 const unsigned id_begin = nPerProc * p_rank ;
64 const unsigned id_end = nPerProc * ( p_rank + 1 );
66 m_node_ids.resize( id_total );
67 m_edge_ids.resize( id_total );
68 std::vector<unsigned> local_count ;
70 for (
unsigned i = 0 ; i < id_total ; ++i ) {
71 m_node_ids[i] = i + 1;
72 m_edge_ids[i] = i + 1;
80 if ( ! m_edge_parts.empty() ) { add_parts.resize(1); }
82 for (
unsigned i = id_begin ; i < id_end ; ++i ) {
83 const unsigned n0 = i ;
84 const unsigned n1 = ( i + 1 ) % id_total ;
85 if ( ! m_edge_parts.empty() ) {
86 add_parts[0] = m_edge_parts[ i % m_edge_parts.size() ];
101 const unsigned nPerProc = m_num_edge_per_proc ;
102 const unsigned id_begin = nPerProc * p_rank ;
107 std::vector<EntityProc> change ;
108 Entity *
const e_node_0 = m_bulk_data.
get_entity( 0 , m_node_ids[id_begin] );
111 entry.first = e_node_0 ;
112 entry.second = ( p_rank + p_size - 1 ) % p_size ;
113 change.push_back( entry );
void declare_relation(Entity &e_from, Entity &e_to, const RelationIdentifier local_id)
Declare a relation and its converse between entities in the same mesh.
Entity * get_entity(EntityRank entity_rank, EntityId entity_id) const
Get entity with a given key.
std::pair< Entity *, unsigned > EntityProc
Pairing of an entity with a processor rank.
unsigned parallel_size() const
Size of the parallel machine.
A fundamental unit within the discretization of a problem domain, including but not limited to nodes...
Part & declare_part(FEMMetaData &meta_data, const std::string &name)
Declare a part with a given cell topology. This is just a convenient function that wraps FEMMetaData'...
void change_entity_owner(const std::vector< EntityProc > &arg_change)
Give away ownership of entities to other parallel processes.
unsigned parallel_rank() const
Rank of the parallel machine's local processor.
Entity & declare_entity(EntityRank ent_rank, EntityId ent_id, const PartVector &parts)
Create or retrieve a locally owned entity of a given rank and id.
void fixup_node_ownership()
std::vector< Part *> PartVector
Collections of parts are frequently maintained as a vector of Part pointers.
unsigned owner_rank() const
Parallel processor rank of the processor which owns this entity.