11 #include <stk_util/environment/ReportHandler.hpp> 13 #include <stk_mesh/fixtures/QuadFixture.hpp> 15 #include <stk_mesh/base/FieldData.hpp> 16 #include <stk_mesh/base/Types.hpp> 17 #include <stk_mesh/base/Entity.hpp> 18 #include <stk_mesh/base/BulkModification.hpp> 20 #include <stk_mesh/fem/Stencils.hpp> 21 #include <stk_mesh/fem/BoundaryAnalysis.hpp> 22 #include <stk_mesh/fem/FEMMetaData.hpp> 23 #include <stk_mesh/fem/FEMHelpers.hpp> 30 unsigned nx ,
unsigned ny )
31 : m_spatial_dimension(2),
32 m_fem_meta( m_spatial_dimension, fem::entity_rank_names(m_spatial_dimension) ),
33 m_bulk_data(
stk_classic::mesh::fem::FEMMetaData::get_meta_data(m_fem_meta) , pm ),
34 m_quad_part( fem::
declare_part<shards::Quadrilateral<4> >(m_fem_meta,
"quad_part" ) ),
35 m_coord_field( m_fem_meta.declare_field<
CoordFieldType>(
"Coordinates") ),
40 typedef shards::Quadrilateral<4> Quad4 ;
41 const unsigned nodes_per_elem = Quad4::node_count;
46 fem::FEMMetaData::NODE_RANK,
63 fem::element_node_stencil<Quad4, 2>,
91 std::vector<EntityId> element_ids_on_this_processor;
95 const unsigned num_elems = m_nx * m_ny;
97 const EntityId beg_elem = 1 + ( num_elems * p_rank ) / p_size ;
98 const EntityId end_elem = 1 + ( num_elems * ( p_rank + 1 ) ) / p_size ;
100 for ( EntityId i = beg_elem; i != end_elem; ++i) {
101 element_ids_on_this_processor.push_back(i);
111 std::vector<EntityId>::iterator ib = element_ids_on_this_processor.begin();
112 std::vector<EntityId>::iterator ie = element_ids_on_this_processor.end();
115 ib = std::unique( ib, ie);
116 element_ids_on_this_processor.erase(ib, ie);
124 std::vector<EntityId>::const_iterator ib = element_ids_on_this_processor.begin();
125 const std::vector<EntityId>::const_iterator ie = element_ids_on_this_processor.end();
126 for (; ib != ie; ++ib) {
128 unsigned ix = 0, iy = 0;
131 stk_classic::mesh::EntityId elem_nodes[4] ;
133 elem_nodes[0] =
node_id( ix , iy );
134 elem_nodes[1] =
node_id( ix+1 , iy );
135 elem_nodes[2] =
node_id( ix+1 , iy+1 );
136 elem_nodes[3] =
node_id( ix , iy+1 );
139 for (
unsigned i = 0; i<4; ++i) {
142 ThrowRequireMsg(
node != NULL,
143 "This process should know about the nodes that make up its element");
146 unsigned nx = 0, ny = 0;
FieldTraits< field_type >::data_type * field_data(const field_type &f, const Bucket::iterator i)
Pointer to the field data array.
Entity & declare_element(BulkData &mesh, Part &part, const EntityId elem_id, const EntityId node_id[])
Declare an element member of a Part with a CellTopology and nodes conformal to that topology.
field_type & put_field(field_type &field, EntityRank entity_rank, const Part &part, const void *init_value=NULL)
Declare a field to exist for a given entity type and Part.
Entity * get_entity(EntityRank entity_rank, EntityId entity_id) const
Get entity with a given key.
Field with defined data type and multi-dimensions (if any)
EntityId elem_id(unsigned x, unsigned y) const
Entity * node(unsigned x, unsigned y) const
bool modification_end()
Parallel synchronization of modifications and transition to the guaranteed parallel consistent state.
unsigned parallel_size() const
Size of the parallel machine.
bool modification_begin()
Begin a modification phase during which the mesh bulk data could become parallel inconsistent....
EntityId entity_id(const EntityKey &key)
Given an entity key, return the identifier for the entity.
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 node_x_y(EntityId entity_id, unsigned &x, unsigned &y) const
unsigned parallel_rank() const
Rank of the parallel machine's local processor.
void elem_x_y(EntityId entity_id, unsigned &x, unsigned &y) const
EntityId node_id(unsigned x, unsigned y) const